{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/17608","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/17608/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17608/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/17608/events","html_url":"https://github.com/symfony/symfony/pull/17608","id":129968000,"number":17608,"title":"[DependencyInjection] Autowiring: add setter injection support","user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars.githubusercontent.com/u/57224?v=3","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/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/Feature","name":"Feature","color":"02e10c"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Work","name":"Status: Needs Work","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2016-01-30T09:53:21Z","updated_at":"2016-03-12T17:00:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/17608","html_url":"https://github.com/symfony/symfony/pull/17608","diff_url":"https://github.com/symfony/symfony/pull/17608.diff","patch_url":"https://github.com/symfony/symfony/pull/17608.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | n/a\r\n| License       | MIT\r\n| Doc PR        | todo\r\n\r\nAdd support for setter injection in the Dependency Injection Component.\r\n\r\nSetter injection should be avoided when possible. However, there is some legitimate use cases for it. This PR follows a proposal of @weaverryan to ease using [DunglasActionBundle](https://github.com/dunglas/DunglasActionBundle) with #16863. The basic idea is to include a setter for the required service in the trait and let the DependencyInjection Component autowire the dependency using the setter.\r\n\r\nThis way, a newcomer can use the trait without having to create or modify the constructor of the action.\r\n\r\n/cc @derrabus"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/195775153","html_url":"https://github.com/symfony/symfony/pull/17608#issuecomment-195775153","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17608","id":195775153,"user":{"login":"dunglas","id":57224,"avatar_url":"https://avatars.githubusercontent.com/u/57224?v=3","gravatar_id":"","url":"https://api.github.com/users/dunglas","html_url":"https://github.com/dunglas","followers_url":"https://api.github.com/users/dunglas/followers","following_url":"https://api.github.com/users/dunglas/following{/other_user}","gists_url":"https://api.github.com/users/dunglas/gists{/gist_id}","starred_url":"https://api.github.com/users/dunglas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dunglas/subscriptions","organizations_url":"https://api.github.com/users/dunglas/orgs","repos_url":"https://api.github.com/users/dunglas/repos","events_url":"https://api.github.com/users/dunglas/events{/privacy}","received_events_url":"https://api.github.com/users/dunglas/received_events","type":"User","site_admin":false},"created_at":"2016-03-12T17:00:49Z","updated_at":"2016-03-12T17:00:49Z","body":"My first implementation was doing exactly what you described in 1). But @fabpot asked for multi-argument support: https://github.com/symfony/symfony/pull/17608#discussion_r51356663\r\nI've no strong opinion about that, I never use multi-dependencies myself, but it doesn't hurt me as well.\r\n\r\n2) make sense only if if we go back to 1) IMO"}}