[FLOW3-general] Howto: Validation (Base Model and Supplemental)?

Thomas Layh thomas at layh.com
Thu Oct 13 16:28:19 CEST 2011


Hi,

I a not completely sure but I think what you want to do is to validate your
registration array or whatever it is.

I wrote a passsowrd validator some time ago and the way I used the
annotations looked like that:

* @param array $password
 * @validate $password
\Layh\Events\Validation\Validator\PasswordValidator(minimumLength = 3)

So in your case the line for the validation could look like:

@validate $registration \Acme\Users\Domain\Validator\RegistrationValidator

Perhaps it helps.

Greetings,
Thomas




On Thu, Oct 13, 2011 at 16:14, Alexander Schnitzler <
mail at alexanderschnitzler.de> wrote:

> Hey folks,
> in the manual there is a part about validation, since today I guess.
> http://flow3.typo3.org/**fileadmin/manual/nightly/**
> TheDefinitiveGuide/PartII/**Validation.html<http://flow3.typo3.org/fileadmin/manual/nightly/TheDefinitiveGuide/PartII/Validation.html>
>
> There it says:
>
>> Base model and supplemental rules are not covered by this tutorial.
>>
>
> Alright, I tried using my own validator, validating a whole model.
>
>  /**
>>  * @param mixed $registration
>>  * @return void
>>  * @validate \Acme\Users\Domain\Validator\**RegistrationValidator
>>  */
>> public function createAccountAction($**registration) {
>>  // something here
>> }
>>
>
>
> Being familiar with extbase I hoped that would work fine, but an exception
> is thrown.
>
>  TYPO3\FLOW3\Error\**ErrorHandler::handleError(8, "Undefined index:
>> argumentName", "/var/www/public_html/FLOW3/**Data/Temporary/Developm…O3_*
>> *FLOW3_Validation_**ValidatorResolver_Original.**php", 199, array)
>>
>
> I guess this is because validators only work for model arguments (yet?),
> don't they? Differs the way of validating whole models from the one in
> Extbase? Is there a tutorial for that or do I just have to validate without
> a validator class inside the controller?
>
> Anyone having an answer to this?
>
> Kind regards!
> Alex
> ______________________________**_________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/flow3-**general<http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general>


More information about the FLOW3-general mailing list