|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de> 00006 * All rights reserved 00007 * 00008 * This class is a backport of the corresponding class of FLOW3. 00009 * All credits go to the v5 team. 00010 * 00011 * This script is part of the TYPO3 project. The TYPO3 project is 00012 * free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * The GNU General Public License can be found at 00018 * http://www.gnu.org/copyleft/gpl.html. 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * This object holds validation errors for one property. 00030 * 00031 * @package Extbase 00032 * @subpackage Validation 00033 * @version $Id: PropertyError.php 1729 2009-11-25 21:37:20Z stucki $ 00034 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later 00035 * @scope prototype 00036 */ 00037 class Tx_Extbase_Validation_PropertyError extends Tx_Extbase_Validation_Error { 00038 00039 /** 00040 * @var string The default (english) error message. 00041 */ 00042 protected $message = 'Validation errors for property "%s"'; 00043 00044 /** 00045 * @var string The error code 00046 */ 00047 protected $code = 1242859509; 00048 00049 /** 00050 * @var string The property name 00051 */ 00052 protected $propertyName; 00053 00054 /** 00055 * @var array An array of Tx_Extbase_Validation_Error for the property 00056 */ 00057 protected $errors = array(); 00058 00059 /** 00060 * Create a new property error with the given property name 00061 * 00062 * @param string $propertyName The property name 00063 */ 00064 public function __construct($propertyName) { 00065 $this->propertyName = $propertyName; 00066 $this->message = sprintf($this->message, $propertyName); 00067 } 00068 00069 /** 00070 * Add errors 00071 * 00072 * @param array $errors Array of Tx_Extbase_Validation_Error for the property 00073 * @return void 00074 */ 00075 public function addErrors($errors) { 00076 $this->errors = array_merge($this->errors, $errors); 00077 } 00078 00079 /** 00080 * Get all errors for the property 00081 * 00082 * @return array An array of Tx_Extbase_Validation_Error objects or an empty array if no errors occured for the property 00083 */ 00084 public function getErrors() { 00085 return $this->errors; 00086 } 00087 00088 /** 00089 * Get the property name 00090 * @return string The property name for this error 00091 */ 00092 public function getPropertyName() { 00093 return $this->propertyName; 00094 } 00095 } 00096 00097 ?>
1.8.0