On 28.01.2011, at 19:53, Dan Leech wrote:
> I have been defining all my forms as services, which seems like good
> practice, but have just
> ran into what seems to be a dead-end when trying to populate a choice
> field from a value in the controller.
>
> For example, to list all of the pages on a specific Site in a
> ChoiceField I need to provide the form with the Site object
> which has been retrieved in the Controller. But as the form is
> instantiated by the DIC I cannot inject the (late)
> dependency, and I cannot set it after instantiation because the Form
> Framework doesnt allow it...
>
> So ... with this limitation in mind, generally, should forms be
> provided as Services, if so do we need to modify the
> form object to enable dependencies to be set after instantiation?
i have a pull open to improve the form context to allow this, though i have
been focused on validation groups
$this->get('my.form.context')->validateGroups(array('foo'))->getForm();
https://github.com/lsmith77/symfony/commit/82a01d3903286ebf1073e4d111d4dac8b52e880e
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