[TYPO3-mvc] Validation

Sebastian Fischer sebastian at fischer.im
Fri Jun 12 17:53:30 CEST 2009


Hi Sebastian,

thanks for explaining this. It will helps me in my session tomorrow at 
the TYPO3camp.

Thanks a lot and many greetings
Sebastian

Sebastian KurfŸürst wrote:
> Hey Sebastian,
> 
>> I know that i need to put reference to a validator into the phpdoc but 
>> how does it work? Does it use reflection?
> Yep, it uses reflection.
> 
> There are several places where you can insert validations:
> 
> -- Inside the Domain Model:
> In the PHPDoc above properties, you can write @validate annotations.
> 
> A "@validate" annotation has always the following format:
> 
> @validate Validator1, ..., ValidatorN
> 
> 
> -- Inside the Controller
> 
> The @validate annotation has the following format here:
> @validate $VariableName Validator1, ..., ValidatorN
> 
> So that is basically the same as inside the domain model, just the 
> $VariableName is added.
> 
> 
> -- General
> 
> Where each Validator is a short validator name (which is resolved inside 
> Tx_Extbase_Validation_Validator_...) - as an example "@validate 
> Alphanumeric".
> The validator can also be a fully qualified class name to a custom 
> validator (which needs to implement the 
> Tx_Extbase_Validation_Validator_ValidatorInterface).
> 
> 
> If the validator needs some arguments, you can specify them in brackets.
> Example:
> @validate StringLength(minimum=3, maximum=50)
> 
> 
> 
> 
> I hope this helps a bit :-)
> 
> Greets,
> Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list