[TYPO3-mvc] Problems with validation non-domain objects

Michael Knoll mimi at kaktusteam.de
Tue Dec 29 13:57:14 CET 2009


Hi there,

I just run into a problem which I don't know whether it's a bug or a 
non-implemented feature. I wanted to do the following, which I think is 
quite useful:

I create a object handling all input of a form. Let's call this object 
"formObject". As it is nothing concerning the domain, I put this object 
in a directory "Lib/FormObject/FormObject.php" and gave it the 
corresponding class name.

Now I can use this formObject in my form viewhelper and my controller 
action which works pretty well (I get a "filled" form object when 
submitting the form).

The next logical step for me was to create a validator for this form 
object which should check the correctness of the values passed by the 
form. And here comes the problem...

I named the validator Tx_EXT_Domain_Validator_FormObjectValidator and 
put it into the "Classes/Domain/Validator" direcotry. The filename is 
"FormObjectValidator.php". When I now put a "return false;" into the 
isValid method, nothing happens. Even die(); in the isValid method 
doesn't have any effect.

So my question is, what am I doing wrong? Can I use validators only for 
domain objects and not for arbitrary objects? Do I have to register my 
validator anywhere?

Thanks for your help - as usually, I will post the solution on my blog 
as a cookbook - recipe :-)

Greetings!

Michael


More information about the TYPO3-project-typo3v4mvc mailing list