symfony/symfony — Issue #3366: ChoiceList's default GENERATE strategy
Author: arnaud-lb
Created: 2012-02-15 11:12:19+00:00
State: open

There are multiple problems with the default GENERATE strategy added in https://github.com/symfony/symfony/pull/3156 :

1. If the order of choices change in the time between the display of a page, and the submition of a form, the wrong value will be set.
2. It works only with browsers: if one built an API, and that API uses forms to handle data posted by clients, one can't use the GENERATE strategy (but what about the empty string problem ?)
3. The generated_value => real_value mapping should be exposed to the client side for javascript.

Point 1 could be addressed by hashing the original value to generate the value (if values aren't objects).

Point 2 can only be addressed by not using this strategy (but what about empty strings ?)