[CLEANUP] Remove old SVN comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Validation / PropertyError.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Validation;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
8 * All rights reserved
9 *
10 * This class is a backport of the corresponding class of FLOW3.
11 * All credits go to the v5 team.
12 *
13 * This script is part of the TYPO3 project. The TYPO3 project is
14 * free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * The GNU General Public License can be found at
20 * http://www.gnu.org/copyleft/gpl.html.
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * This object holds validation errors for one property.
31 *
32 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
33 * @scope prototype
34 * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
35 */
36 class PropertyError extends \TYPO3\CMS\Extbase\Validation\Error {
37
38 /**
39 * @var string The default (english) error message.
40 */
41 protected $message = 'Validation errors for property "%s"';
42
43 /**
44 * @var string The error code
45 */
46 protected $code = 1242859509;
47
48 /**
49 * @var string The property name
50 */
51 protected $propertyName;
52
53 /**
54 * @var array An array of \TYPO3\CMS\Extbase\Validation\Error for the property
55 */
56 protected $errors = array();
57
58 /**
59 * Create a new property error with the given property name
60 *
61 * @param string $propertyName The property name
62 */
63 public function __construct($propertyName) {
64 $this->propertyName = $propertyName;
65 $this->message = sprintf($this->message, $propertyName);
66 }
67
68 /**
69 * Add errors
70 *
71 * @param array $errors Array of \TYPO3\CMS\Extbase\Validation\Error for the property
72 * @return void
73 */
74 public function addErrors($errors) {
75 $this->errors = array_merge($this->errors, $errors);
76 }
77
78 /**
79 * Get all errors for the property
80 *
81 * @return array An array of \TYPO3\CMS\Extbase\Validation\Error objects or an empty array if no errors occured for the property
82 */
83 public function getErrors() {
84 return $this->errors;
85 }
86
87 /**
88 * Get the property name
89 *
90 * @return string The property name for this error
91 */
92 public function getPropertyName() {
93 return $this->propertyName;
94 }
95
96 }
97
98
99 ?>