From d685d7d08bffda5bbbff5526104010ead9fc134f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20=E2=80=9CFelds=E2=80=9D=20Liscia?= Date: Tue, 11 Mar 2014 11:49:06 -0300 Subject: [PATCH] Cast the group name as a string This allows the options to be grouped by association fields. --- .../Form/Extension/Core/ChoiceList/ObjectChoiceList.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php index 7c7aa0c768..0f1437db21 100644 --- a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php +++ b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php @@ -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; } }