{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/9476","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/9476/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/9476/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/9476/events","html_url":"https://github.com/yiisoft/yii2/issues/9476","id":102083618,"number":9476,"title":"DI injection via method signature","user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:enhancement","name":"type:enhancement","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-20T07:55:09Z","updated_at":"2015-08-21T07:33:05Z","closed_at":null,"body":"While constructor injection is enough in general, controllers are a special case because there are too many different contexts (actions) and each needs a separate set of class instances.\r\n\r\nWould be cool to support doing it like this instead of checking for action name in constructor:\r\n\r\n```php\r\nclass PostController extends Controller\r\n{\r\n    public function actionView($id, OpenGraphInterface $og)\r\n    {\r\n        $post = Post::findOne($id);\r\n        $meta = $og->getMeta($post);\r\n        // ...\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/133315630","html_url":"https://github.com/yiisoft/yii2/issues/9476#issuecomment-133315630","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/9476","id":133315630,"user":{"login":"df2","id":1834925,"avatar_url":"https://avatars.githubusercontent.com/u/1834925?v=3","gravatar_id":"","url":"https://api.github.com/users/df2","html_url":"https://github.com/df2","followers_url":"https://api.github.com/users/df2/followers","following_url":"https://api.github.com/users/df2/following{/other_user}","gists_url":"https://api.github.com/users/df2/gists{/gist_id}","starred_url":"https://api.github.com/users/df2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/df2/subscriptions","organizations_url":"https://api.github.com/users/df2/orgs","repos_url":"https://api.github.com/users/df2/repos","events_url":"https://api.github.com/users/df2/events{/privacy}","received_events_url":"https://api.github.com/users/df2/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T07:33:05Z","updated_at":"2015-08-21T07:33:05Z","body":"@samdark \r\n\r\nWhen would the services be binded? After beforeAction event?"}}