{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/15079","labels_url":"https://api.github.com/repos/symfony/symfony/issues/15079/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/15079/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/15079/events","html_url":"https://github.com/symfony/symfony/pull/15079","id":90436122,"number":15079,"title":"[Form] Deprecated FormTypeInterface::getName() and passing of type instances","user":{"login":"webmozart","id":176399,"avatar_url":"https://avatars.githubusercontent.com/u/176399?v=3","gravatar_id":"","url":"https://api.github.com/users/webmozart","html_url":"https://github.com/webmozart","followers_url":"https://api.github.com/users/webmozart/followers","following_url":"https://api.github.com/users/webmozart/following{/other_user}","gists_url":"https://api.github.com/users/webmozart/gists{/gist_id}","starred_url":"https://api.github.com/users/webmozart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webmozart/subscriptions","organizations_url":"https://api.github.com/users/webmozart/orgs","repos_url":"https://api.github.com/users/webmozart/repos","events_url":"https://api.github.com/users/webmozart/events{/privacy}","received_events_url":"https://api.github.com/users/webmozart/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/DX","name":"DX","color":"5319e7"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Form","name":"Form","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Ready","name":"Ready","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-06-23T16:45:39Z","updated_at":"2015-06-24T14:32:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/15079","html_url":"https://github.com/symfony/symfony/pull/15079","diff_url":"https://github.com/symfony/symfony/pull/15079.diff","patch_url":"https://github.com/symfony/symfony/pull/15079.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | yes\r\n| Tests pass?   | yes\r\n| Fixed tickets | #5321, #15008\r\n| License       | MIT\r\n| Doc PR        | TODO\r\n\r\nThis PR deprecates the definition of the `getName()` method of form types as well as setting the `alias` in the DIC configuration. See #15008 for a more detailed description.\r\n\r\nBefore:\r\n\r\n```php\r\nclass MyType extends AbstractType\r\n{\r\n    public function getName()\r\n    {\r\n        return 'mytype';\r\n    }\r\n\r\n    // ...\r\n}\r\n```\r\n\r\nAfter:\r\n\r\n```php\r\nclass MyType extends AbstractType\r\n{\r\n    // ...\r\n}\r\n```\r\n\r\nFurthermore, passing of type instances is not supported anymore. You should always reference other types by their fully-qualified class names. Thanks to PHP 5.5, that's easy:\r\n\r\nBefore:\r\n\r\n```php\r\n$form = $this->createFormBuilder()\r\n    ->add('name', 'text')\r\n    ->add('age', 'integer')\r\n    ->getForm();\r\n\r\n$form = $this->createForm(new AuthorType());\r\n```\r\n\r\nAfter:\r\n\r\n```php\r\n$form = $this->createFormBuilder()\r\n    ->add('name', TextType::class)\r\n    ->add('age', IntegerType::class)\r\n    ->getForm();\r\n\r\n$form = $this->createForm(AuthorType::class);\r\n```\r\n\r\nWhen registering a type in the DIC, you should omit the \"alias\" attribute now.\r\n\r\nBefore:\r\n\r\n```xml\r\n<service id=\"my.type\" class=\"Vendor\\Type\\MyType\">\r\n    <tag name=\"form.type\" alias=\"mytype\" />\r\n    <argument type=\"service\" id=\"some.service.id\" />\r\n</service>\r\n```\r\n   \r\nAfter:\r\n  \r\n```xml\r\n<service id=\"my.type\" class=\"Vendor\\Type\\MyType\">\r\n    <tag name=\"form.type\" />\r\n    <argument type=\"service\" id=\"some.service.id\" />\r\n</service>\r\n```\r\n\r\nTypes without dependencies don't need to be registered in the DIC as they can be instantiated right away."},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/114889019","html_url":"https://github.com/symfony/symfony/pull/15079#issuecomment-114889019","issue_url":"https://api.github.com/repos/symfony/symfony/issues/15079","id":114889019,"user":{"login":"DavidBadura","id":470138,"avatar_url":"https://avatars.githubusercontent.com/u/470138?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidBadura","html_url":"https://github.com/DavidBadura","followers_url":"https://api.github.com/users/DavidBadura/followers","following_url":"https://api.github.com/users/DavidBadura/following{/other_user}","gists_url":"https://api.github.com/users/DavidBadura/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidBadura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidBadura/subscriptions","organizations_url":"https://api.github.com/users/DavidBadura/orgs","repos_url":"https://api.github.com/users/DavidBadura/repos","events_url":"https://api.github.com/users/DavidBadura/events{/privacy}","received_events_url":"https://api.github.com/users/DavidBadura/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T14:32:15Z","updated_at":"2015-06-24T14:32:15Z","body":"@webmozart we can change it. I just wanted to have said it. :wink: "}}