File indexing completed on 2024-06-16 05:30:32

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Validate
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /**
0023  * @see Zend_Validate_Db_Abstract
0024  */
0025 // require_once 'Zend/Validate/Db/Abstract.php';
0026 
0027 /**
0028  * Confirms a record exists in a table.
0029  *
0030  * @category   Zend
0031  * @package    Zend_Validate
0032  * @uses       Zend_Validate_Db_Abstract
0033  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0034  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0035  */
0036 class Zend_Validate_Db_RecordExists extends Zend_Validate_Db_Abstract
0037 {
0038     public function isValid($value)
0039     {
0040         $valid = true;
0041         $this->_setValue($value);
0042 
0043         $result = $this->_query($value);
0044         if (!$result) {
0045             $valid = false;
0046             $this->_error(self::ERROR_NO_RECORD_FOUND);
0047         }
0048 
0049         return $valid;
0050     }
0051 }