Cast the group name as a string

This allows the options to be grouped by association fields.
This commit is contained in:
Luiz “Felds” Liscia 2014-03-11 11:49:06 -03:00 committed by Fabien Potencier
parent fb2ce7a171
commit d685d7d08b

View File

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