symfony/symfony — pull request #3505 by Burgov (2012-03-05 15:40:26+00:00)
Title: Fix form get parent default options 2 0

...alling the parent's getParent() method

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: Yes
Fixes the following tickets: -

I ran into the following situation:

I defined a new Form Type, which extends the choice type. Since this new Form Type always needs to be expanded and multiple, I overrode these options in the getDefaultOptionsMethod().

These options were passed into the buildForm method of the choice type just fine, but not into the getParent() method of the choice type.

The result of this was that the parent of the choice type became "field" rather than "form", and even though the checkbox list is rendered fine, and even posts the correct values on submit, the checkbox list is not actually filled before show - all checkboxes are empty. This is because the datamapper on this specific form is not set, since this only happens for types with parent 'form'.

This PR makes sure the default options of the child type are passed to the getParent() method of the parent type.