{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/17019","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/17019/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17019/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/17019/events","html_url":"https://github.com/symfony/symfony/issues/17019","id":122263167,"number":17019,"title":"[Form] choice_attr option in ChoiceType generates options attributes wrong","user":{"login":"a-sane","id":764967,"avatar_url":"https://avatars.githubusercontent.com/u/764967?v=3","gravatar_id":"","url":"https://api.github.com/users/a-sane","html_url":"https://github.com/a-sane","followers_url":"https://api.github.com/users/a-sane/followers","following_url":"https://api.github.com/users/a-sane/following{/other_user}","gists_url":"https://api.github.com/users/a-sane/gists{/gist_id}","starred_url":"https://api.github.com/users/a-sane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-sane/subscriptions","organizations_url":"https://api.github.com/users/a-sane/orgs","repos_url":"https://api.github.com/users/a-sane/repos","events_url":"https://api.github.com/users/a-sane/events{/privacy}","received_events_url":"https://api.github.com/users/a-sane/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Form","name":"Form","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Reviewed","name":"Status: Reviewed","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-12-15T12:34:56Z","updated_at":"2016-02-12T10:11:10Z","closed_at":null,"body":"All code tested on clean symfony 2.8 installation\r\n\r\nI've created TestFormType\r\n\r\n```php\r\nclass TestType extends AbstractType\r\n{\r\n    public function buildForm(FormBuilderInterface $builder, array $options)\r\n    {\r\n        $builder\r\n            ->add('testChoice', 'choice', [\r\n                'choices' => [\r\n                    1 => 'test 1',\r\n                    2 => 'test 2',\r\n                    3 => 'test 3',\r\n                ],\r\n                'choice_attr' => [\r\n                    1 => ['data-test' => 'test 1'],\r\n                    2 => ['data-test' => 'test 2'],\r\n                    3 => ['data-test' => 'test 3'],\r\n                ],\r\n            ]);\r\n    }\r\n} \r\n```\r\n\r\nand i got this in view: \r\n\r\n```html\r\n<select id=\"test_testChoice\" name=\"test[testChoice]\">\r\n    <option value=\"1\">test 1</option>\r\n    <option value=\"2\" data-test=\"test 1\">test 2</option>\r\n    <option value=\"3\" data-test=\"test 2\">test 3</option>\r\n</select>\r\n```\r\n\r\nsame with placeholder option:\r\n\r\n```php\r\nclass TestType extends AbstractType\r\n{\r\n    public function buildForm(FormBuilderInterface $builder, array $options)\r\n    {\r\n        $builder\r\n            ->add('testChoice', 'choice', [\r\n                'choices' => [\r\n                    1 => 'test 1',\r\n                    2 => 'test 2',\r\n                    3 => 'test 3',\r\n                ],\r\n                'placeholder' => 'test placeholder',\r\n                'choice_attr' => [\r\n                    1 => ['data-test' => 'test 1'],\r\n                    2 => ['data-test' => 'test 2'],\r\n                    3 => ['data-test' => 'test 3'],\r\n                ],\r\n            ]);\r\n    }\r\n} \r\n```\r\n\r\n```html\r\n<select id=\"test_testChoice\" name=\"test[testChoice]\" required=\"required\">\r\n    <option value=\"\" selected=\"selected\">test placeholder</option>\r\n    <option value=\"1\">test 1</option>\r\n    <option value=\"2\" data-test=\"test 1\">test 2</option>\r\n    <option value=\"3\" data-test=\"test 2\">test 3</option>\r\n</select> \r\n```\r\ni'm not sure, but i think problem near this commit: https://github.com/symfony/symfony/commit/d94c322272f2fb9bd934b1b2dbfb8a5b0169f899\r\nprobably in normalizeLegacyChoices method"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/183260731","html_url":"https://github.com/symfony/symfony/issues/17019#issuecomment-183260731","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17019","id":183260731,"user":{"login":"ureimers","id":1671217,"avatar_url":"https://avatars.githubusercontent.com/u/1671217?v=3","gravatar_id":"","url":"https://api.github.com/users/ureimers","html_url":"https://github.com/ureimers","followers_url":"https://api.github.com/users/ureimers/followers","following_url":"https://api.github.com/users/ureimers/following{/other_user}","gists_url":"https://api.github.com/users/ureimers/gists{/gist_id}","starred_url":"https://api.github.com/users/ureimers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ureimers/subscriptions","organizations_url":"https://api.github.com/users/ureimers/orgs","repos_url":"https://api.github.com/users/ureimers/repos","events_url":"https://api.github.com/users/ureimers/events{/privacy}","received_events_url":"https://api.github.com/users/ureimers/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T10:11:10Z","updated_at":"2016-02-12T10:11:10Z","body":"Phew, that was a comprehensive but very clear roundup. Thank you for taking the time to write it down!"}}