[TYPO3-mvc] Accesssing other properties during validation
Nikolas Hagelstein
lists at shr-now.de
Mon Jan 4 14:47:39 CET 2010
Hi,
Talking about controller argument validation, i use to solve this issue by
passing key and
container to the validator and attaching the validator itself to one of the
involved arguments.
E.g. I got a matchRequestArgumentValidator to compare things like password
and passwordConfirmation.
I attach it to one of the involved arguments (e.g. password) like:
@validate $password
Tx_Foo_Validator_MatchRequestArgumentalidator(matchArgument='passwordConfirm
ation',
argumentContainer='tx_foo_bar').
Within the validator I use the passed options to extract the needed argument
out of the $_POST array.
Not that elegant but, IMHO there is no other way without having the
validator being aware of it's context.
Furthermore, things might get even more complicated talking about model
property validation.
Since I am not aware of a way to pass the current instance of an domain
object to the validator. :|.
(see http://forge.typo3.org/issues/show/5044)
Regards,
Nikolas
More information about the TYPO3-project-typo3v4mvc
mailing list