+1

Validation should be performed before setting the data on a object and
if the validation does not pass it should not be set at all.

On Nov 3, 2:21 pm, Lukas Kahwe Smith <[email protected]> wrote:
> On 03.11.2010, at 13:12, Bernhard Schussek wrote:
>
> > I agree that it would be magnific if we could constrain method
> > parameters. But to automate this would require AOP, which is not
> > supported by PHP. So the only other reasonable approach IMO is to
> > validate data that is already written into the object, by validating
> > property/getter values.
>
> > Pulling the validation definition completely out of the objects and
> > into the form would be a step backwards now.
>
> but you set the values in the entity. why can't you validate the data just 
> before you set it?
>
> > @Lukas: Your use cases can be solved differently. Aside from the
> > object also the form field is validated. You could f.i. constrain
> > getDisplayedData(), which contains exactly what the user has entered
> > into the field.
>
> hmm not sure what you mean here exactly. how/what should i be constraining? 
> also note in the entity i dont have access to the form anymore.
>
> regards,
> 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

Reply via email to