|
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 * The Mapping Results 00030 * 00031 * @package Extbase 00032 * @subpackage Property 00033 * @version $Id: MappingResults.php 1052 2009-08-05 21:51:32Z sebastian $ 00034 * @scope prototype 00035 */ 00036 class Tx_Extbase_Property_MappingResults { 00037 00038 /** 00039 * @var array An array of the occured errors 00040 */ 00041 protected $errors = array(); 00042 00043 /** 00044 * @var array An array of the occured warnings 00045 */ 00046 protected $warnings = array(); 00047 00048 /** 00049 * Adds an error to the mapping results. This might be for example a 00050 * validation or mapping error 00051 * 00052 * @param Tx_Extbase_Error_Error $error The occured error 00053 * @param string $propertyName The name of the property which caused the error 00054 */ 00055 public function addError(Tx_Extbase_Error_Error $error, $propertyName) { 00056 $this->errors[$propertyName] = $error; 00057 } 00058 00059 /** 00060 * Returns all errors that occured so far 00061 * 00062 * @return array Array of Tx_Extbase_Error_Error 00063 */ 00064 public function getErrors() { 00065 return $this->errors; 00066 } 00067 00068 /** 00069 * Returns true if any error was recognized 00070 * 00071 * @return boolean True if an error occured 00072 */ 00073 public function hasErrors() { 00074 return (count($this->errors) > 0); 00075 } 00076 00077 /** 00078 * Adds a warning to the mapping results. This might be for example a 00079 * property that could not be mapped but wasn't marked as required. 00080 * 00081 * @param string $warning The occured warning 00082 * @param string $propertyName The name of the property which caused the error 00083 */ 00084 public function addWarning($warning, $propertyName) { 00085 $this->warnings[$propertyName] = $warning; 00086 } 00087 00088 /** 00089 * Returns all warnings that occured so far 00090 * 00091 * @return array Array of warnings 00092 */ 00093 public function getWarnings() { 00094 return $this->warnings; 00095 } 00096 00097 /** 00098 * Returns TRUE if any warning was recognized 00099 * 00100 * @return boolean TRUE if a warning occured 00101 */ 00102 public function hasWarnings() { 00103 return (count($this->warnings) > 0); 00104 } 00105 } 00106 00107 ?>
1.8.0