{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/19832","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/19832/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/19832/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/19832/events","html_url":"https://github.com/symfony/symfony/issues/19832","id":174845518,"number":19832,"title":"Add an alias to a service","user":{"login":"theofidry","id":5175937,"avatar_url":"https://avatars.githubusercontent.com/u/5175937?v=3","gravatar_id":"","url":"https://api.github.com/users/theofidry","html_url":"https://github.com/theofidry","followers_url":"https://api.github.com/users/theofidry/followers","following_url":"https://api.github.com/users/theofidry/following{/other_user}","gists_url":"https://api.github.com/users/theofidry/gists{/gist_id}","starred_url":"https://api.github.com/users/theofidry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theofidry/subscriptions","organizations_url":"https://api.github.com/users/theofidry/orgs","repos_url":"https://api.github.com/users/theofidry/repos","events_url":"https://api.github.com/users/theofidry/events{/privacy}","received_events_url":"https://api.github.com/users/theofidry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/DependencyInjection","name":"DependencyInjection","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/DX","name":"DX","color":"5319e7"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-09-02T20:52:05Z","updated_at":"2016-09-06T20:14:21Z","closed_at":null,"body":"As of now, the declaration of an alias is done like so:\r\n\r\n```yaml\r\nservices:\r\n   app.phpmailer:\r\n     class: AppBundle\\Mail\\PhpMailer\r\n\r\n   app.mailer:\r\n     alias: app.phpmailer\r\n```\r\n\r\n([example taken from the doc](http://symfony.com/doc/current/service_container/alias_private.html#aliasing)).\r\n\r\nThis means you needs to register *two* services definitions. IMO this is unnecessary and could be done in one service declaration:\r\n\r\n```yaml\r\nservices:\r\n   app.phpmailer:\r\n     alias: app.phpmail\r\n     class: AppBundle\\Mail\\PhpMailer\r\n```\r\n\r\nNow because of the BC promise and because it would change the current behaviour, another key than `alias` should be found for that (`aliases` that could be an array to register several aliases at once?), but I find it more intuitive than having the two service declarations and I think this can be the source of confusion as you may think of `alias` as \"this service has this alias\" and not \"this service is an alias declaration\". I've recently seen two peoples tricked by that realising it only because of the recent deprecation notices and I remember being confused by it at first as well when I started Symfony.\r\n\r\nWDYT?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/245075841","html_url":"https://github.com/symfony/symfony/issues/19832#issuecomment-245075841","issue_url":"https://api.github.com/repos/symfony/symfony/issues/19832","id":245075841,"user":{"login":"Ener-Getick","id":6871899,"avatar_url":"https://avatars.githubusercontent.com/u/6871899?v=3","gravatar_id":"","url":"https://api.github.com/users/Ener-Getick","html_url":"https://github.com/Ener-Getick","followers_url":"https://api.github.com/users/Ener-Getick/followers","following_url":"https://api.github.com/users/Ener-Getick/following{/other_user}","gists_url":"https://api.github.com/users/Ener-Getick/gists{/gist_id}","starred_url":"https://api.github.com/users/Ener-Getick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ener-Getick/subscriptions","organizations_url":"https://api.github.com/users/Ener-Getick/orgs","repos_url":"https://api.github.com/users/Ener-Getick/repos","events_url":"https://api.github.com/users/Ener-Getick/events{/privacy}","received_events_url":"https://api.github.com/users/Ener-Getick/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T20:14:21Z","updated_at":"2016-09-06T20:14:21Z","body":"Ok got it.\r\nWhat about `Using the attribute \"class\" is deprecated for alias definition \"bar\". This attribute belongs to a service definition (e.g. no \"alias\" attribute). Available attributes for aliases are: \"alias\", \"public\".`?"}}
{"actor":{"display_login":"Ener-Getick"}}