[TYPO3-mvc] Get another property in custom validator
Philipp
philippwrann at gmx.at
Thu Oct 31 14:53:16 CET 2013
you need the validation annotation above your controller action. Not your Model Property
If you place a Validator above your property it is considered a property validator, you need an object validator, so you have to place it above your action....
/**
* action create
*
* @param \Pr\Sp\Domain\Model\User $newUser
* @validate $newUser \Pr\Sp\Validation\Validator\UserValidator
* @return void
*/
public function createAction(\Profinit\Spiritit\Domain\Model\User
$newUser) {
}
but i would make it in this specific case a little different.
Submit both password and passwordConfirmation as separat arguments to your controller, check them there and if the comparison fails forward to your new action. Additionally you add a new flashMessage. If the confirmation is true you save a generated has as password in the model.
That way you dont have a cleartext password in your model...
More information about the TYPO3-project-typo3v4mvc
mailing list