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