8000 minor #18299 [Form] Remove unused legacy code in `ChoiceType` (HeahDude) · symfony/symfony@90ece1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 90ece1c

Browse files
committed
minor #18299 [Form] Remove unused legacy code in ChoiceType (HeahDude)
This PR was merged into the 3.0 branch. Discussion ---------- [Form] Remove unused legacy code in `ChoiceType` | Q | A | ------------- | --- | Branch? | 3.0 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | - Commits ------- 8af78e9 [Form] Remove unused legacy code in `ChoiceType`
2 parents 06b1e5d + 8af78e9 commit 90ece1c

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -357,21 +357,6 @@ public function getBlockPrefix()
357357
return 'choice';
358358
}
359359

360-
private static function flipRecursive($choices, &$output = array())
361-
{
362-
foreach ($choices as $key => $value) {
363-
if (is_array($value)) {
364-
$output[$key] = array();
365-
self::flipRecursive($value, $output[$key]);
366-
continue;
367-
}
368-
369-
$output[$value] = $key;
370-
}
371-
372-
return $output;
373-
}
374-
375360
/**
376361
* Adds the sub fields for an expanded choice field.
377362
*
@@ -447,9 +432,7 @@ private function createChoiceListView(ChoiceListInterface $choiceList, array $op
447432
// If no explicit grouping information is given, use the structural
448433
// information from the "choices" option for creating groups
449434
if (!$options['group_by'] && $options['choices']) {
450-
$options['group_by'] = !$options['choices_as_values']
451-
? self::flipRecursive($options['choices'])
452-
: $options['choices'];
435+
$options['group_by'] = $options['choices'];
453436
}
454437

455438
return $this->choiceListFactory->createView(

0 commit comments

Comments
 (0)
0