/** * * @see Core/Data/Atrox_Core_Data_IValidator#validate($value) */ public function validate($value, Atrox_Core_Data_Property $property) { $dataSource = $property->getDataSource(); $filter = $property->getDataSource()->makeFilter(); $filter->addConditional($dataSource->getTableName(), $property->getName(), $value); $count = $dataSource->count($filter); return $count <= 1 ? true : "'" . $property->getDescription() . "' must be unique. '{$value}' is already used"; }
/** * * @param Atrox_Core_Data_Property $property * @return string */ public function parseProperty(Atrox_Core_Data_Property $property) { return $this->parseTable($property->getDataSource()->getTableName()) . "." . $this->parseField($property->getName()); }