Description
I've done several Symfony projects beyond version 2.7.* in which I've used the ChoiceType
form element by setting the choices
option to an array using the convention value => label
.
However, I just noticed the convention has changed to label => value
, via http://symfony.com/blog/new-in-symfony-2-7-choice-form-type-refactorization and http://symfony.com/doc/current/reference/forms/types/choice.html#choices.
This change doesn't make sense to me. The convention has always been value => label
anytime I've worked with a form APIs. This convention is intuitive with the uniqueness of array keys. It also mimics the <select>
element.
Flipping the convention, I see at least three issues:
- potential to have duplicate values in a form selection (I can't think of a reason this is useful)
- potential to lose a selection if two labels are equal (eg. a User selection where their names are labels)
- everyone has to change their code and way of thinking to move forward with Symfony
Can someone elaborate as to why this drastic of a change needed to happen? If the choices
really needed to be backwards, that could have been done internally without affecting convention.