From fb4d8de5e4c99d074d6b8f67f9251671014a931b Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Fri, 31 Mar 2017 10:23:48 +0200 Subject: [PATCH] Avoid forcing to define the choices_as_values option when using choice_loader When using the choice loader, choices are ignored entirely. Forcing the dev to add the choices_as_values just to avoid the deprecation warning (and then to remove the option again at some point in 3.x due to deprecation) is a bad developer experience. --- src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 26f7c80f1766..61907067f576 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -357,7 +357,7 @@ public function configureOptions(OptionsResolver $resolver) }; $choicesAsValuesNormalizer = function (Options $options, $choicesAsValues) use ($that) { - if (true !== $choicesAsValues) { + if (true !== $choicesAsValues && null === $options['choice_loader']) { @trigger_error(sprintf('The value "false" for the "choices_as_values" option of the "%s" form type (%s) is deprecated since version 2.8 and will not be supported anymore in 3.0. Set this option to "true" and flip the contents of the "choices" option instead.', $that->getName(), __CLASS__), E_USER_DEPRECATED); }