{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/16296","labels_url":"https://api.github.com/repos/symfony/symfony/issues/16296/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/16296/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/16296/events","html_url":"https://github.com/symfony/symfony/issues/16296","id":112363956,"number":16296,"title":"[Form] [2.8] Naming forms works only in some cases; passing extra params to a form","user":{"login":"petforsberg","id":8122620,"avatar_url":"https://avatars.githubusercontent.com/u/8122620?v=3","gravatar_id":"","url":"https://api.github.com/users/petforsberg","html_url":"https://github.com/petforsberg","followers_url":"https://api.github.com/users/petforsberg/followers","following_url":"https://api.github.com/users/petforsberg/following{/other_user}","gists_url":"https://api.github.com/users/petforsberg/gists{/gist_id}","starred_url":"https://api.github.com/users/petforsberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petforsberg/subscriptions","organizations_url":"https://api.github.com/users/petforsberg/orgs","repos_url":"https://api.github.com/users/petforsberg/repos","events_url":"https://api.github.com/users/petforsberg/events{/privacy}","received_events_url":"https://api.github.com/users/petforsberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-20T13:03:21Z","updated_at":"2015-10-20T13:13:50Z","closed_at":null,"body":"**1.**\r\n\r\nThere's a new way to naming forms with help of getBlockPrefix() method, according to the upgrade info https://github.com/symfony/symfony/blob/2.8/UPGRADE-2.8.md.\r\n\r\nThe problem is it works only when Forms are **instantiated** e.g.:\r\n\r\n     new MyFormType()\r\n\r\nBut not by a **class** name, e.g.:\r\n\r\n     'AppBundle/MyFormType'\r\n\r\nIn the second case, I get the form name like 'my_form' regardless whatever I put into the getBlockPrefix() or getName() methods. But when I pass to the Form Factory **an instance** of my form type (e.g. new MyFormType() as shown above ), the generated form has the proper block prefix - the one I set, e.g. 'profile' in the example from the upgrade text file:\r\n\r\n\tclass UserProfileType extends AbstractType\r\n\t{\r\n\t   public function getBlockPrefix()\r\n\t   {\r\n\t\t   return 'profile';\r\n\t   }\r\n\t}\r\n\r\n**2.**\r\n\r\nIt seems that when one tries to create a form in a new way (with a class), it seems there's no any possibility to pass any parameters to its constructor.\r\nMaybe introducing some extra array param to the Form Factory when creating a form from a class would resolve the issue?"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/149563590","html_url":"https://github.com/symfony/symfony/issues/16296#issuecomment-149563590","issue_url":"https://api.github.com/repos/symfony/symfony/issues/16296","id":149563590,"user":{"login":"craue","id":800119,"avatar_url":"https://avatars.githubusercontent.com/u/800119?v=3","gravatar_id":"","url":"https://api.github.com/users/craue","html_url":"https://github.com/craue","followers_url":"https://api.github.com/users/craue/followers","following_url":"https://api.github.com/users/craue/following{/other_user}","gists_url":"https://api.github.com/users/craue/gists{/gist_id}","starred_url":"https://api.github.com/users/craue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craue/subscriptions","organizations_url":"https://api.github.com/users/craue/orgs","repos_url":"https://api.github.com/users/craue/repos","events_url":"https://api.github.com/users/craue/events{/privacy}","received_events_url":"https://api.github.com/users/craue/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T13:13:50Z","updated_at":"2015-10-20T13:13:50Z","body":"The first part is probably related to #15760."}}