diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 835f3767e5..26af37b9ac 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -420,7 +420,7 @@ class ChoiceType extends AbstractType $resolver->setAllowedTypes('choice_value', array('null', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath')); $resolver->setAllowedTypes('choice_attr', array('null', 'array', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath')); $resolver->setAllowedTypes('preferred_choices', array('array', '\Traversable', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath')); - $resolver->setAllowedTypes('group_by', array('null', 'array', '\Traversable', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath')); + $resolver->setAllowedTypes('group_by', array('null', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath')); } /** @@ -431,21 +431,6 @@ class ChoiceType extends AbstractType return 'choice'; } - private static function flipRecursive($choices, &$output = array()) - { - foreach ($choices as $key => $value) { - if (is_array($value)) { - $output[$key] = array(); - self::flipRecursive($value, $output[$key]); - continue; - } - - $output[$value] = $key; - } - - return $output; - } - /** * Adds the sub fields for an expanded choice field. * @@ -503,14 +488,6 @@ class ChoiceType extends AbstractType private function createChoiceListView(ChoiceListInterface $choiceList, array $options) { - // If no explicit grouping information is given, use the structural - // information from the "choices" option for creating groups - if (!$options['group_by'] && $options['choices']) { - $options['group_by'] = !$options['choices_as_values'] - ? self::flipRecursive($options['choices']) - : $options['choices']; - } - return $this->choiceListFactory->createView( $choiceList, $options['preferred_choices'],