symfony/symfony — pull request #3504 by Burgov (2012-03-05 15:21:36+00:00)
Title: made sure the child type default options are passed to the parent when c...

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