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

Sebastian Kurfürst sebastian at typo3.org
Thu Dec 31 11:26:31 CET 2009


Hi Michael,

Currently, the "magic" only works for objects which are in the
Domain/Model directory. For each domain object, it finds the validator
the following way (currently) -- this is implemented in
Tx_Extbase_Validation_ValidatorResolver:
- Replace "Model" by "Validator" in the path
- Append "Validator"

So, you need to place your FormObject f.e. in
Domain/Model/FormObject.php, and then the Validator will be
automatically called if it is in Domain/Validator/FormObjectValidator.php.

Your FormObject class does _NOT_ have to extend from AbstractEntity or
AbstractValueObject if you don't want persistence.

But if I understood you correctly, the FormObject is nothing in your
business domain, so it should not reside in "Domain". Is this correct?

It should be possible to have f.e.
Classes/Application/Form/FormObject.php
and then the Validator in
Classes/Application/Validator/FormObjectValidator.php

Greets,
Sebastian
PS: Just a sidenote - I feel that your names "Lib" and "...Object" are a
bit misleading - maybe they still can be improved a bit ;-)


More information about the TYPO3-project-typo3v4mvc mailing list