bug #10416 [Form] Allow options to be grouped by objects (felds)

This PR was submitted for the 2.3-dev branch but it was merged into the 2.3 branch instead (closes #10416).

Discussion
----------

[Form] Allow options to be grouped by objects

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

ae3f02f Cast the group name as a string
This commit is contained in:
Fabien Potencier 2014-03-21 12:48:43 +01:00
commit bbaa839a82

View File

@ -128,11 +128,13 @@ class ObjectChoiceList extends ChoiceList
if (null === $group) {
$groupedChoices[$i] = $choice;
} else {
if (!isset($groupedChoices[$group])) {
$groupedChoices[$group] = array();
$groupName = (string) $group;
if (!isset($groupedChoices[$groupName])) {
$groupedChoices[$groupName] = array();
}
$groupedChoices[$group][$i] = $choice;
$groupedChoices[$groupName][$i] = $choice;
}
}