{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/16863","labels_url":"https://api.github.com/repos/symfony/symfony/issues/16863/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/16863/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/16863/events","html_url":"https://github.com/symfony/symfony/pull/16863","id":120565678,"number":16863,"title":"[FrameworkBundle][RFC] Controller should be a trait","user":{"login":"derrabus","id":1506493,"avatar_url":"https://avatars.githubusercontent.com/u/1506493?v=3","gravatar_id":"","url":"https://api.github.com/users/derrabus","html_url":"https://github.com/derrabus","followers_url":"https://api.github.com/users/derrabus/followers","following_url":"https://api.github.com/users/derrabus/following{/other_user}","gists_url":"https://api.github.com/users/derrabus/gists{/gist_id}","starred_url":"https://api.github.com/users/derrabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derrabus/subscriptions","organizations_url":"https://api.github.com/users/derrabus/orgs","repos_url":"https://api.github.com/users/derrabus/repos","events_url":"https://api.github.com/users/derrabus/events{/privacy}","received_events_url":"https://api.github.com/users/derrabus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Review","name":"Status: Needs Review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-05T15:21:37Z","updated_at":"2015-12-06T15:31:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/16863","html_url":"https://github.com/symfony/symfony/pull/16863","diff_url":"https://github.com/symfony/symfony/pull/16863.diff","patch_url":"https://github.com/symfony/symfony/pull/16863.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 | none\r\n| License       | MIT\r\n| Doc PR        | none (yet)\r\n\r\nThis PR came to my mind during the SymfonyCon hack day. Following the `ContainerAware` class that has been transformed into a trait, I'd like to do the same with FrameworkBundle's `Controller` class. As far as I can tell, there is no reason anymore why `Controller` has to be a class.\r\n\r\nThis PR serves as a proof of concept. Since this class is used quite often, I'm not entirely sure if we should go this way. The upgrade path is pretty easy though.\r\n\r\n```php\r\nclass MyController extends Controller\r\n{\r\n}\r\n```\r\nbecomes\r\n```php\r\nclass MyController implements ContainerAware\r\n{\r\n    use ControllerTrait;\r\n}\r\n```\r\nIf we decide to do this, the next step (imho) would be to split `ContainerTrait` into smaller parts that might as well be reused in controllers that are not container-aware."},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/162323810","html_url":"https://github.com/symfony/symfony/pull/16863#issuecomment-162323810","issue_url":"https://api.github.com/repos/symfony/symfony/issues/16863","id":162323810,"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":"2015-12-06T15:31:25Z","updated_at":"2015-12-06T15:31:25Z","body":"@sstok It needs to be benchmarked but even if you have 200 controllers in your app I'm not sure it will make a big difference from a performance point of view."}}