Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #17822 [WIP] [2.7] [Form] fix
empty_data
option in expanded `Ch…
…oiceType` (HeahDude) This PR was merged into the 2.7 branch. Discussion ---------- [WIP] [2.7] [Form] fix `empty_data` option in expanded `ChoiceType` | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17791 | License | MIT | Doc PR | - It might happen because in `Form::submit()` the handling of `empty_data` [line 597](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L597) comes after each child of a compound field has been submitted [line 549](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L549). So when `ChoiceType` is `expanded`, `compound` option is defaulted to `true` and it passes its empty submitted data to its children before handling its own `empty_data` option. This PR uses the listener already added in `ChoiceType` only when `expanded` is true to handle `empty_data` at `PRE_SUBMIT` [line 539](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L539). - [ ] Fix FQCN in tests for 2.8 - [ ] Remove `choices_as_values` in tests for 3.0 Commits ------- d479adf [Form] fix `empty_data` option in expanded `ChoiceType`
- Loading branch information