Er, sounds "good" (: On Mon, Mar 15, 2010 at 7:15 PM, Bernhard Schussek <[email protected]> wrote: > 2010/3/15 Jacob Coby <[email protected]>: >> Why not make the models responsible for data validation? I've never >> understood the desire to require the use of form objects. > > This is exactly what is happening in Symfony 2. > > You can define constraints on properties and methods of your model. > You can, for instance, specify that the $age property of class Address > must be NotNull and an Integer with a min value of 10 and a max value > of 100. The seperate Validator component can be used to validate these > constraints on a given object. > > Now the validator doesn't care where it is called. It can be called > from Doctrine event listeners like preUpdate etc. The form, too, uses > the validator to validate an object after the form submission and > displays the errors returned by the validator. > > The above mentioned constraints can also be assigned to groups, if > desired. This allows you to define several different or overlapping > sets of constraints for the same class (f.i. "Strict", "Admin", > "Backend" etc.). Groups can be organized in hierarchies. You can also > define group sequences, which means that first one group is validated, > then, if it was successful, the next group etc. (useful for wizards, > ajax forms...) > > The new validator is really very powerful. I will publish more > information when the implementation is somewhat stable. Until then, > you can checkout the code at > http://github.com/bschussek/symfony/tree/forms-experimental/src/Symfony/Components/Validator/ > > Bernhard > > -- > 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 >
-- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com -- 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
