public function __construct($options, $name = null, $min = 1, $max = 50) { parent::__construct($name, $min, $max); $this->dbNoRecordExistsValidator = new NoRecordExists($options); $this->getValidatorChain()->attach($this->dbNoRecordExistsValidator); $messageTemplates = [NoRecordExists::ERROR_RECORD_FOUND => "Перевод для указанного ключа уже существует"]; $this->dbNoRecordExistsValidator->setMessages($messageTemplates); $this->getFilterChain()->attachByName('StringTrim'); }
public function getNoRecordExistsValidator() { if ($this->noRecordExistsValidator === NULL) { $validator = new NoRecordExists($this->getNoRecordExistsConfig()); $validator->setMessages(array(NoRecordExists::ERROR_NO_RECORD_FOUND => $this->getErrorMessage('RECORD_EXISTS::ERROR_NO_RECORD_FOUND'), NoRecordExists::ERROR_RECORD_FOUND => $this->getErrorMessage('NO_RECORD_EXISTS::ERROR_RECORD_FOUND'))); $this->setNoRecordExistsValidator($validator); } return $this->noRecordExistsValidator; }