Skip to content

[Form] Remove unused legacy code in ChoiceType #18299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,6 @@ public function getBlockPrefix()
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.
*
Expand Down Expand Up @@ -447,9 +432,7 @@ private function createChoiceListView(ChoiceListInterface $choiceList, array $op
// 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'];
$options['group_by'] = $options['choices'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone still uses the choices_as_values option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh Thanks for the review.

choices_as_values is normalized to true since 3.0 and deprecated in 3.1.

This change is safe.

}

return $this->choiceListFactory->createView(
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy