[TYPO3-mvc] validate domain object in own validator

Domi djgarms at gmail.com
Thu Aug 23 02:25:26 CEST 2012


Hello,

I wrote an own register validator which getting called, if a specific 
action getting called:

	/**
	 * action create
	 *
	 * @param $client
	 * @validate $client Tx_Intranet_Domain_Validator_ClientRegisterValidator
	 * @return void
	 */
	public function createAction(Tx_Intranet_Domain_Model_Client $client) {

...
}

And here the validator:


class Tx_Intranet_Domain_Validator_ClientRegisterValidator extends 
Tx_Extbase_Validation_Validator_AbstractValidator {

      /**
      * @param Tx_Intranet_Domain_Model_Client $value
      */
     public function isValid($value) {

(...)

  	$this->options['email'] = new 
Tx_Extbase_Validation_PropertyError('email');
	$this->options['client']['email'] = $this->addError('User with this 
email already exists', 99988776);

(...)

}
}

My current problem is: the validation works, but the error doesn't gets 
addressed to my property "email", its only in the errors of my client 
object, so I can't make an specific output for this error.

THX
Dominic


More information about the TYPO3-project-typo3v4mvc mailing list