{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/14377","labels_url":"https://api.github.com/repos/symfony/symfony/issues/14377/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/14377/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/14377/events","html_url":"https://github.com/symfony/symfony/issues/14377","id":68917183,"number":14377,"title":"[Form] choices_as_value not working properly with associative arrays","user":{"login":"Soullivaneuh","id":1698357,"avatar_url":"https://avatars.githubusercontent.com/u/1698357?v=3","gravatar_id":"","url":"https://api.github.com/users/Soullivaneuh","html_url":"https://github.com/Soullivaneuh","followers_url":"https://api.github.com/users/Soullivaneuh/followers","following_url":"https://api.github.com/users/Soullivaneuh/following{/other_user}","gists_url":"https://api.github.com/users/Soullivaneuh/gists{/gist_id}","starred_url":"https://api.github.com/users/Soullivaneuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soullivaneuh/subscriptions","organizations_url":"https://api.github.com/users/Soullivaneuh/orgs","repos_url":"https://api.github.com/users/Soullivaneuh/repos","events_url":"https://api.github.com/users/Soullivaneuh/events{/privacy}","received_events_url":"https://api.github.com/users/Soullivaneuh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-04-16T12:51:34Z","updated_at":"2015-05-26T11:15:28Z","closed_at":null,"body":"By following the upgrade to 2.7 documentation, I'm changing `choice` options.\r\n\r\nWith the given form:\r\n\r\n```php\r\n->add('environment', 'choice', [\r\n    'choices'       => [\r\n        'production'    => 'Production',\r\n        'beta'          => 'Beta',\r\n        'development'   => 'Development',\r\n        'binpkg'        => 'BinPkg',\r\n    ],\r\n])\r\n```\r\n\r\nWe get this output:\r\n\r\n```html\r\n<select>\r\n\t<option value=\"\"></option>\r\n\t<option value=\"production\">Production</option>\r\n\t<option value=\"beta\">Beta</option>\r\n\t<option value=\"development\">Development</option>\r\n\t<option value=\"binpkg\">BinPkg</option>\r\n</select>\r\n```\r\n\r\nIf I try to reverse choices and use `choices_as_value` option:\r\n\r\n```php\r\n->add('environment', 'choice', [\r\n    'choices'       => [\r\n        'Production'    => 'production',\r\n        'Beta'          => 'beta',\r\n        'Development'   => 'development',\r\n        'BinPkg'        => 'binpkg',\r\n    ],\r\n    'choices_as_values' => true,\r\n])\r\n```\r\n\r\nI got this:\r\n\r\n```html\r\n<select>\r\n\t<option value=\"\"></option>\r\n\t<option value=\"0\">Production</option>\r\n\t<option value=\"1\">Beta</option>\r\n\t<option value=\"2\">Development</option>\r\n\t<option value=\"3\">BinPkg</option>\r\n</select>\r\n```\r\n\r\nAs you can see, my associated array keys are simply ignored and replaced by numeric values."},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/105491767","html_url":"https://github.com/symfony/symfony/issues/14377#issuecomment-105491767","issue_url":"https://api.github.com/repos/symfony/symfony/issues/14377","id":105491767,"user":{"login":"Soullivaneuh","id":1698357,"avatar_url":"https://avatars.githubusercontent.com/u/1698357?v=3","gravatar_id":"","url":"https://api.github.com/users/Soullivaneuh","html_url":"https://github.com/Soullivaneuh","followers_url":"https://api.github.com/users/Soullivaneuh/followers","following_url":"https://api.github.com/users/Soullivaneuh/following{/other_user}","gists_url":"https://api.github.com/users/Soullivaneuh/gists{/gist_id}","starred_url":"https://api.github.com/users/Soullivaneuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soullivaneuh/subscriptions","organizations_url":"https://api.github.com/users/Soullivaneuh/orgs","repos_url":"https://api.github.com/users/Soullivaneuh/repos","events_url":"https://api.github.com/users/Soullivaneuh/events{/privacy}","received_events_url":"https://api.github.com/users/Soullivaneuh/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T11:15:28Z","updated_at":"2015-05-26T11:15:28Z","body":"Any new for this issue? Would be great to solve it before 2.7 stable release.\r\n\r\nping @webmozart @fabpot "}}