On 20.01.2011, at 12:58, Bernhard Schussek wrote:
> 2011/1/20 Lukas Kahwe Smith <[email protected]>:
>> Like I said, if I have a form which I want to use with different validation
>> groups I now either have to:
>
> Can you give me an example when you want to use the same form with
> different validation groups? I want to understand the problem better.
One might have different validation requirements based on the user that is
authenticated. Also a form to create/edit users might have different
requirements for initial creation than editing (aka one might want to be more
lax for legacy users).
>> Now if we disallow setting options via setters, then I think we should make
>> that factory service the _only_ way to make form instances. Aka make the
>> constructor protected and provide a form creation service as part of
>> Symfony2 core.
>
> There is one, although I'm still writing the documentation for it:
>
> $form = $this->get('form.factory')->getForm('author', $author);
>
> if you want to use custom validation groups
>
> $form = $this->get('form.factory')
> ->validationGroups('Address')
> ->getForm('author', $author);
ok sounds good!
i will look into adding this into FOS\UserBundle and will provide feedback if
necessary.
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