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

Michael Knoll mimi at kaktusteam.de
Fri Jan 1 13:42:53 CET 2010


Hi Sebastian,

thanks for your answer. At the moment I put everything in the Domain 
folder, but I will change this to meet your recommendations. I wanted to 
create an folder Lib containing kind of API stuff. I'd really like to do 
some renaming and "directory refactoring", but wanted to write tests 
first, to make sure everything is working afterwards (see my last post, 
which you answered as well...).

> 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"

Ok - I will take a look at that class!

> 
> 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.

That's what I'm doing at the moment!
> 
> Your FormObject class does _NOT_ have to extend from AbstractEntity or
> AbstractValueObject if you don't want persistence.

Yep - I just used a "POPO" (Plain old PHP Object :-) )
> 
> But if I understood you correctly, the FormObject is nothing in your
> business domain, so it should not reside in "Domain". Is this correct?

That's what I think - it has nothing got to do with the domain of my 
application but only supports form handling. So I would really like to 
reside it outside the "Domain" directory, but still want it to be validated.
> 
> It should be possible to have f.e.
> Classes/Application/Form/FormObject.php
> and then the Validator in
> Classes/Application/Validator/FormObjectValidator.php

Does this mean, that it would be a "nice to have" feature or that this 
is already working?
> 
> 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 ;-)

You are right of course - as soon as I get the testing done, I will fix 
this!


Greetings

Michael


More information about the TYPO3-project-typo3v4mvc mailing list