[TYPO3-mvc] Own Object Validator
Stefan Kruse
besucher80 at gmx.de
Thu Nov 7 19:38:47 CET 2013
Hi,
i have a form use my own validator. Inside the isValid method I make my
validation and add if need the error with $this->addError(...);.
Could someone explain how to make a property error? I found this, but that
doesn't work. Is there a other way?
/**
* @param Tx_ExtensionName_Domain_Model_ModelName $value
* @return bool
*/
public function isValid($value)
{
$this->errors = array();
if ($this->modelNameRepository->findByEmail($value->getEmail())->count() >
0) {
$this->errors['email'] = new
Tx_Extbase_Validation_PropertyError('email', time());
$this->errors['email']->addErrors(array(new
Tx_Extbase_Validation_Error('Email not unique', 84647862842)));
return false;
}
return true;
}
Thanks STefn
More information about the TYPO3-project-typo3v4mvc
mailing list