[TYPO3-mvc] Validating nested objects on create
Franz Koch
typo3.RemoveForMessage at elements-net.de
Mon Dec 20 16:39:18 CET 2010
Hey Claus,
>> ---- part of my generic object validator ----------
>> public function isValid($value) {
>> $dataType = $this->options['dataType'];
>
> where do you call this validator from and how do you get the data type ?
>
> This looks like you pass every nested object to this validator and
> 'dataType' is type of the passed object, right ?
yes, dataType is the type/className of the object to be validated.
Unfortunately I didn't find a nice way to automatically fetch the
classname from the property annotation, so I passed it as validator
argument like this:
/**
* address
* @var Tx_ExtName_Domain_Model_Address
* @validate
Tx_ExtName_Validator_GenericObjectValidator(dataType=Tx_ExtName_Domain_Model_Address)
*/
protected $address;
> Do you use a customer domain object validator (called from controller
> action), walk through the nested objects and call the generic validator
> from this ?
only using the validate annotation, see above.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list