*
*
*
*
*
*
*
* @author Michael Aichler
* @version $Revision: 1612 $
* @package propel.runtime.validator
*/
class UniqueValidator implements BasicValidator
{
/**
* @see BasicValidator::isValid()
*/
public function isValid (ValidatorMap $map, $str)
{
$column = $map->getColumn();
$c = new Criteria();
$c->add($column->getFullyQualifiedName(), $str, Criteria::EQUAL);
$table = $column->getTable()->getClassName();
$clazz = $table . 'Peer';
$count = call_user_func(array($clazz, 'doCount'), $c);
$isValid = ($count === 0);
return $isValid;
}
}