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.
This commit is contained in:
parent
a0e654d981
commit
fb4d8de5e4
@ -357,7 +357,7 @@ class ChoiceType extends AbstractType
|
|||||||
};
|
};
|
||||||
|
|
||||||
$choicesAsValuesNormalizer = function (Options $options, $choicesAsValues) use ($that) {
|
$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);
|
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user