[TYPO3-mvc] Validating multiple arguments in one custom validator

Nikolas Hagelstein lists at shr.cc
Wed Mar 2 10:40:32 CET 2011


Hi,

Am 01.03.2011 15:34, schrieb Henrik M. Rasmussen:
> Controller:
> - newAction($someObject=null, $myArr=null)
> - createAction($someObject, $myArr=null)
>
 > [..]
> But now I need access to the $myArr from within the validation of
> $someObject. Any idea how this is possible?

Well either use a custom validation within your controller like Peter 
suggested. Or rethink your "models".

Real world example:

Model User:
------------
-username
-firstName
-lastName
-password
-email


newAction($newUser, $passwordConfirmation) (you would like to compare 
$passwordConfirmation with user->password to see if both are equal ).

So better:
newAction($newUser, $password) {
	$newUser->setPassword($password);
}

where password is an object:

Model password:
------
-password
-passwordConfirmation
method toString (You could even take salted passwords into account here ).

Hope this helps,
Nikolas










More information about the TYPO3-project-typo3v4mvc mailing list