I assume this reply was suppose to go to the list :) Begin forwarded message:
> From: Bernhard Schussek <[email protected]> > Date: 2. Januar 2011 19:20:06 MEZ > To: Lukas Kahwe Smith <[email protected]> > Subject: Re: [Symfony2] validation annotations > > Hi Lukas, > > Solution (3) is the recommended syntax. (1) and (2) include > unnecessary overhead. > > @validation:Validation is only required if you want to define multiple > constraints of the same type (e.g. several @Min constraints) on the > same field (because the Doctrine2 parser only allows one annotation of > a given type for a property). I want to rename this constraint to > something more intuitive like "Set". > > Cheers, > Bernhard > -- > Software Architect & Engineer > Blog: http://webmozarts.com > Twitter: http://twitter.com/webmozart > > > > 2010/12/12 Lukas Kahwe Smith <[email protected]>: >> Hi Bernhard, >> >> Just trying to get an understanding of the annotation syntax to use for the >> validation annotations: >> >> 1) See this example file in DoctrineUserBundle: >> https://github.com/knplabs/DoctrineUserBundle/blob/symfony2Security/Model/User.php >> >> /** >> * @validation:Validation({ >> * @validation:NotBlank(message="Please enter a username", >> groups="Registration"), >> * @validation:MinLength(limit=2, message="The username is too >> short", groups="Registration"), >> * @validation:MaxLength(limit=255, message="The username is too >> long", groups="Registration") >> * }) >> */ >> >> 2) I guess this could also be written like so: >> /** >> * ({ >> * @validation:NotBlank(message="Please enter a username", >> groups="Registration"), >> * @validation:MinLength(limit=2, message="The username is too >> short", groups="Registration"), >> * @validation:MaxLength(limit=255, message="The username is too >> long", groups="Registration") >> * }) >> */ >> >> 3) But the following also seems to work: >> >> /** >> * @validation:NotBlank(message="Please enter a username", >> groups="Registration"), >> * @validation:MinLength(limit=2, message="The username is too >> short", groups="Registration"), >> * @validation:MaxLength(limit=255, message="The username is too >> long", groups="Registration") >> */ >> >> Are all of these version equivalent? Are 1) and 2) just syntax sugar? >> >> regards, >> Lukas Kahwe Smith >> [email protected] >> >> >> >> Lukas Kahwe Smith [email protected] -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
