Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Validator / Db / NoRecordExists.php
blob6fc7cd07a0d2548879bc23f16b7241cb7e5f88da
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Validator\Db;
12 use Zend\Validator\Exception;
14 /**
15 * Confirms a record does not exist in a table.
17 class NoRecordExists extends AbstractDb
19 public function isValid($value)
22 * Check for an adapter being defined. If not, throw an exception.
24 if (null === $this->adapter) {
25 throw new Exception\RuntimeException('No database adapter present');
28 $valid = true;
29 $this->setValue($value);
31 $result = $this->query($value);
32 if ($result) {
33 $valid = false;
34 $this->error(self::ERROR_RECORD_FOUND);
37 return $valid;