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.

> 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);

or, outside of Symfony2

// you can pass XML and YML file paths to buildDefault()
$factory = FormFactory::buildDefault();
$form = $factory
    ->validationGroups('Address')
    ->getForm('author', $author);

Bernhard
--
Software Architect & Engineer
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart

-- 
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