| [ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: ValidationFailed.php 282 2005-11-25 14:20:51Z hans $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://propel.phpdb.org>. 20 */ 21 22 23 /** 24 * Simple class that serves as a container for any information about a failed validation. 25 * 26 * Currently this class stores the qualified column name (e.g. tablename.COLUMN_NAME) and 27 * the message that should be displayed to the user. 28 * 29 * An array of these objects will be returned by BasePeer::doValidate() if validation 30 * failed. 31 * 32 * @author Hans Lellelid <hans@xmpl.org> 33 * @version $Revision: 282 $ 34 * @package propel.validator 35 * @see BasePeer::doValidate() 36 */ 37 class ValidationFailed { 38 39 /** Column name in tablename.COLUMN_NAME format */ 40 private $colname; 41 42 /** Message to display to user. */ 43 private $message; 44 45 /** Validator object that caused this to fail. */ 46 private $validator; 47 48 /** 49 * Construct a new ValidationFailed object. 50 * @param string $colname Column name. 51 * @param string $message Message to display to user. 52 * @param object $validator The Validator that caused this column to fail. 53 */ 54 public function __construct($colname, $message, $validator = null) 55 { 56 $this->colname = $colname; 57 $this->message = $message; 58 $this->validator = $validator; 59 } 60 61 /** 62 * Set the column name. 63 * @param string $v 64 */ 65 public function setColumn($v) 66 { 67 $this->colname = $v; 68 } 69 70 /** 71 * Gets the column name. 72 * @return string Qualified column name (tablename.COLUMN_NAME) 73 */ 74 public function getColumn() 75 { 76 return $this->colname; 77 } 78 79 /** 80 * Set the message for the validation failure. 81 * @param string $v 82 */ 83 public function setMessage($v) 84 { 85 $this->message = $v; 86 } 87 88 /** 89 * Gets the message for the validation failure. 90 * @return string 91 */ 92 public function getMessage() 93 { 94 return $this->message; 95 } 96 97 /** 98 * Set the validator object that caused this to fail. 99 * @param object $v 100 */ 101 public function setValidator($v) 102 { 103 $this->validator = $v; 104 } 105 106 /** 107 * Gets the validator object that caused this to fail. 108 * @return object 109 */ 110 public function getValidator() 111 { 112 return $this->validator; 113 } 114 115 /** 116 * "magic" method to get string represenation of object. 117 * Maybe someday PHP5 will support the invoking this method automatically 118 * on (string) cast. Until then it's pretty useless. 119 * @return string 120 */ 121 public function __toString() 122 { 123 return $this->getMessage(); 124 } 125 126 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |