[BUGFIX] Fix classes without or broken namespace
[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 * @package Extbase
33 * @subpackage Validation
34 * @version $Id$
35 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
36 * @scope prototype
37 * @deprecated since Extbase 1.4.0, will be removed in Extbase 6.0
38 */
39 class PropertyError extends \TYPO3\CMS\Extbase\Validation\Error {
40
41 /**
42 * @var string The default (english) error message.
43 */
44 protected $message = 'Validation errors for property "%s"';
45
46 /**
47 * @var string The error code
48 */
49 protected $code = 1242859509;
50
51 /**
52 * @var string The property name
53 */
54 protected $propertyName;
55
56 /**
57 * @var array An array of \TYPO3\CMS\Extbase\Validation\Error for the property
58 */
59 protected $errors = array();
60
61 /**
62 * Create a new property error with the given property name
63 *
64 * @param string $propertyName The property name
65 */
66 public function __construct($propertyName) {
67 $this->propertyName = $propertyName;
68 $this->message = sprintf($this->message, $propertyName);
69 }
70
71 /**
72 * Add errors
73 *
74 * @param array $errors Array of \TYPO3\CMS\Extbase\Validation\Error for the property
75 * @return void
76 */
77 public function addErrors($errors) {
78 $this->errors = array_merge($this->errors, $errors);
79 }
80
81 /**
82 * Get all errors for the property
83 *
84 * @return array An array of \TYPO3\CMS\Extbase\Validation\Error objects or an empty array if no errors occured for the property
85 */
86 public function getErrors() {
87 return $this->errors;
88 }
89
90 /**
91 * Get the property name
92 *
93 * @return string The property name for this error
94 */
95 public function getPropertyName() {
96 return $this->propertyName;
97 }
98
99 }
100
101
102 ?>