{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/17791","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/17791/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17791/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/17791/events","html_url":"https://github.com/symfony/symfony/issues/17791","id":133442162,"number":17791,"title":"[3.0.2]problem with buildForm (formtype)","user":{"login":"alex1442","id":13075675,"avatar_url":"https://avatars.githubusercontent.com/u/13075675?v=3","gravatar_id":"","url":"https://api.github.com/users/alex1442","html_url":"https://github.com/alex1442","followers_url":"https://api.github.com/users/alex1442/followers","following_url":"https://api.github.com/users/alex1442/following{/other_user}","gists_url":"https://api.github.com/users/alex1442/gists{/gist_id}","starred_url":"https://api.github.com/users/alex1442/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex1442/subscriptions","organizations_url":"https://api.github.com/users/alex1442/orgs","repos_url":"https://api.github.com/users/alex1442/repos","events_url":"https://api.github.com/users/alex1442/events{/privacy}","received_events_url":"https://api.github.com/users/alex1442/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":5,"created_at":"2016-02-13T15:42:03Z","updated_at":"2016-02-15T11:15:47Z","closed_at":null,"body":"in ChoiceType::class\r\nif expanded set to `true` then\r\nparameter 'empty_data'  ignored ,\r\n\r\nvalidator return error not null for this value\r\n\r\na similar problem https://github.com/symfony/symfony/issues/17789\r\nsf 3.0.2"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/184170564","html_url":"https://github.com/symfony/symfony/issues/17791#issuecomment-184170564","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17791","id":184170564,"user":{"login":"HeahDude","id":10107633,"avatar_url":"https://avatars.githubusercontent.com/u/10107633?v=3","gravatar_id":"","url":"https://api.github.com/users/HeahDude","html_url":"https://github.com/HeahDude","followers_url":"https://api.github.com/users/HeahDude/followers","following_url":"https://api.github.com/users/HeahDude/following{/other_user}","gists_url":"https://api.github.com/users/HeahDude/gists{/gist_id}","starred_url":"https://api.github.com/users/HeahDude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HeahDude/subscriptions","organizations_url":"https://api.github.com/users/HeahDude/orgs","repos_url":"https://api.github.com/users/HeahDude/repos","events_url":"https://api.github.com/users/HeahDude/events{/privacy}","received_events_url":"https://api.github.com/users/HeahDude/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T11:15:47Z","updated_at":"2016-02-15T11:15:47Z","body":"Beware if you set `empty_data` as a callable you should use this code instead from [line 93 of `ChoiceType`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L92) :\r\n```php\r\n$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {\r\n    $form = $event->getForm();\r\n    $data = $event->getData();\r\n\r\n    if (FormUtil::isEmpty($data)) {\r\n        $emptyData = $form->getConfig()->getEmptyData();\r\n        if (is_callable($emptyData)) {\r\n            $emptyData = call_user_func($emptyData, $form, $data);\r\n        }\r\n        $data = (string) $emptyData;\r\n}\r\n```"}}