"Title is already assigned", ); public function __construct($option) { if ($option instanceof Zend_Config) { $option = $option->toArray(); } if (is_array($option)) { if (array_key_exists('title', $option)) { $this->oldTitle = $option['title']; } } } protected $oldTitle; public function isValid($value) { $this->_setValue($value); if(empty($this->oldTitle)) { $eventMapper = new Application_Model_EventMapper(); $sameEvent = $eventMapper->findBy(array("title" => $value)); if (count($sameEvent) > 0) { $this->_error(self::NOT_UNIQUE); return false; } else { return true; } } else { if($this->oldTitle == $value) { return true; } else { $eventMapper = new Application_Model_EventMapper(); $sameEvent = $eventMapper->findBy(array("title" => $value)); if (count($sameEvent) > 0) { $this->_error(self::NOT_UNIQUE); return false; } else { return true; } } } } }