

Public Member Functions | |
| getExclude () | |
| Returns the set exclude clause. | |
| getField () | |
| Returns the set field. | |
| getTable () | |
| Get Table. | |
| isValid ($value) | |
| setExclude ($exclude) | |
| Sets a new exclude clause. | |
| setField ($field) | |
| Sets a new field. | |
| setTable ($table) | |
| Set Table. | |
Public Attributes | |
| const | ERROR_NO_RECORD_FOUND = 'noRecordFound' |
| Error constants. | |
| const | ERROR_RECORD_FOUND = 'recordFound' |
Protected Member Functions | |
| _query ($value) | |
| Run query and returns matches, or null if no matches are found. | |
Protected Attributes | |
| $_exclude = null | |
| $_field = '' | |
| $_messageTemplates | |
| $_table = '' | |
Definition at line 33 of file NoRecordExists.php.
| Robo47_Validate_Doctrine_Abstract::_query | ( | $ | value | ) | [protected, inherited] |
Run query and returns matches, or null if no matches are found.
| String | $value |
Definition at line 153 of file Abstract.php.
References Robo47_Validate_Doctrine_Abstract::getExclude(), Robo47_Validate_Doctrine_Abstract::getField(), and Robo47_Validate_Doctrine_Abstract::getTable().
Referenced by Robo47_Validate_Doctrine_RecordExists::isValid(), and isValid().
{
$query = $this->getTable()->createQuery();
$exclude = $this->getExclude();
if (is_string($exclude) && !empty($exclude)) {
$query->andWhere($exclude);
} else if (is_array($exclude) && !empty($exclude)) {
$query->andWhere($exclude['field'] . ' != ?', $exclude['value']);
}
return $query->andWhere($this->getField() . ' = ?', $value)
->limit(1)
->execute();
}


| Robo47_Validate_Doctrine_Abstract::getExclude | ( | ) | [inherited] |
Returns the set exclude clause.
Definition at line 79 of file Abstract.php.
Referenced by Robo47_Validate_Doctrine_Abstract::_query().
{
return $this->_exclude;
}

| Robo47_Validate_Doctrine_Abstract::getField | ( | ) | [inherited] |
Returns the set field.
Definition at line 101 of file Abstract.php.
Referenced by Robo47_Validate_Doctrine_Abstract::_query().
{
return $this->_field;
}

| Robo47_Validate_Doctrine_Abstract::getTable | ( | ) | [inherited] |
Get Table.
Definition at line 142 of file Abstract.php.
Referenced by Robo47_Validate_Doctrine_Abstract::_query(), and Robo47_Validate_Doctrine_Abstract::setTable().
{
return $this->_table;
}

| Robo47_Validate_Doctrine_NoRecordExists::isValid | ( | $ | value | ) |
Definition at line 37 of file NoRecordExists.php.
References Robo47_Validate_Doctrine_Abstract::_query().
{
$valid = true;
$this->_setValue($value);
$result = $this->_query($value);
if (count($result) != 0) {
$valid = false;
$this->_error(self::ERROR_RECORD_FOUND);
}
return $valid;
}

| Robo47_Validate_Doctrine_Abstract::setExclude | ( | $ | exclude | ) | [inherited] |
Sets a new exclude clause.
| string|array | $exclude |
Definition at line 90 of file Abstract.php.
Referenced by Robo47_Validate_Doctrine_Abstract::__construct().
{
$this->_exclude = $exclude;
return $this;
}

| Robo47_Validate_Doctrine_Abstract::setField | ( | $ | field | ) | [inherited] |
Sets a new field.
| string | $field |
Definition at line 112 of file Abstract.php.
Referenced by Robo47_Validate_Doctrine_Abstract::__construct().
{
$this->_field = (string) $field;
return $this;
}

| Robo47_Validate_Doctrine_Abstract::setTable | ( | $ | table | ) | [inherited] |
Set Table.
| Doctrine_Table|string | $table |
Definition at line 124 of file Abstract.php.
References Robo47_Validate_Doctrine_Abstract::getTable().
Referenced by Robo47_Validate_Doctrine_Abstract::__construct().
{
if (is_string($table)) {
$table = Doctrine_Core::getTable($table);
}
if (!$table instanceof Doctrine_Table) {
$message = 'table not instance of Doctrine_Table.';
throw new Robo47_Log_Writer_Exception($message);
}
$this->_table = $table;
return $this;
}


Robo47_Validate_Doctrine_Abstract::$_exclude = null [protected, inherited] |
Definition at line 59 of file Abstract.php.
Robo47_Validate_Doctrine_Abstract::$_field = '' [protected, inherited] |
Definition at line 55 of file Abstract.php.
Robo47_Validate_Doctrine_Abstract::$_messageTemplates [protected, inherited] |
array(
self::ERROR_NO_RECORD_FOUND => 'No record matching %value% was found',
self::ERROR_RECORD_FOUND => 'A record matching %value% was found',
)
Definition at line 44 of file Abstract.php.
Robo47_Validate_Doctrine_Abstract::$_table = '' [protected, inherited] |
Definition at line 51 of file Abstract.php.
const Robo47_Validate_Doctrine_Abstract::ERROR_NO_RECORD_FOUND = 'noRecordFound' [inherited] |
Error constants.
Definition at line 38 of file Abstract.php.
const Robo47_Validate_Doctrine_Abstract::ERROR_RECORD_FOUND = 'recordFound' [inherited] |
Definition at line 39 of file Abstract.php.
1.7.1