{"action":"created","issue":{"url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/1068","repository_url":"https://api.github.com/repos/sonata-project/SonataMediaBundle","labels_url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/1068/labels{/name}","comments_url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/1068/comments","events_url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/1068/events","html_url":"https://github.com/sonata-project/SonataMediaBundle/issues/1068","id":162853900,"number":1068,"title":"Controller not ready for SF3","user":{"login":"clytemnestra","id":7060048,"avatar_url":"https://avatars.githubusercontent.com/u/7060048?v=3","gravatar_id":"","url":"https://api.github.com/users/clytemnestra","html_url":"https://github.com/clytemnestra","followers_url":"https://api.github.com/users/clytemnestra/followers","following_url":"https://api.github.com/users/clytemnestra/following{/other_user}","gists_url":"https://api.github.com/users/clytemnestra/gists{/gist_id}","starred_url":"https://api.github.com/users/clytemnestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clytemnestra/subscriptions","organizations_url":"https://api.github.com/users/clytemnestra/orgs","repos_url":"https://api.github.com/users/clytemnestra/repos","events_url":"https://api.github.com/users/clytemnestra/events{/privacy}","received_events_url":"https://api.github.com/users/clytemnestra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-29T06:56:30Z","updated_at":"2016-06-29T07:38:37Z","closed_at":null,"body":"#### Sonata packages\r\n```bash\r\n$ composer show sonata-project/*\r\nsonata-project/admin-bundle              3.3.2              The missing Symfony Admin Generator\r\nsonata-project/block-bundle              3.0.1              Symfony SonataBlockBundle\r\nsonata-project/cache                     1.0.7              Cache library\r\nsonata-project/classification-bundle     3.0.0              Symfony SonataClassificationBundle\r\nsonata-project/core-bundle               3.0.3              Symfony SonataCoreBundle\r\nsonata-project/datagrid-bundle           2.2                Symfony SonataDatagridBundle\r\nsonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions\r\nsonata-project/doctrine-orm-admin-bundle 3.0.4              Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle\r\nsonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle\r\nsonata-project/exporter                  1.5.0              Lightweight Exporter library\r\nsonata-project/intl-bundle               2.2.4              Symfony SonataIntlBundle\r\nsonata-project/media-bundle              dev-master 1eeae18 Symfony SonataMediaBundle\r\nsonata-project/notification-bundle       3.0.0              Symfony SonataNotificationBundle\r\n```\r\n\r\n#### Symfony packages\r\n\r\n```bash\r\n$ composer show symfony/*\r\nsymfony/monolog-bundle     2.11.1  Symfony MonologBundle\r\nsymfony/phpunit-bridge     v3.1.1  Symfony PHPUnit Bridge\r\nsymfony/polyfill-apcu      v1.2.0  Symfony polyfill backporting apcu_* functions to lower PHP versions\r\nsymfony/polyfill-intl-icu  v1.2.0  Symfony polyfill for intl's ICU-related data and classes\r\nsymfony/polyfill-mbstring  v1.2.0  Symfony polyfill for the Mbstring extension\r\nsymfony/polyfill-php56     v1.2.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions\r\nsymfony/polyfill-php70     v1.2.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions\r\nsymfony/polyfill-util      v1.2.0  Symfony utilities for portability of PHP codes\r\nsymfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)\r\nsymfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle\r\nsymfony/symfony            v3.1.1  The Symfony PHP framework\r\n```\r\n\r\n#### PHP version\r\n\r\n```bash\r\n$ php -v\r\nPHP 5.6.20 (cli) (built: Mar 31 2016 14:56:44) \r\nCopyright (c) 1997-2016 The PHP Group\r\nZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies\r\n```\r\n\r\n## Subject\r\n\r\nThe [MediaController](https://github.com/sonata-project/SonataMediaBundle/blob/3.x/Controller/MediaController.php) makes calls to ```$this->get('request')``` and ``` $this->getRequest()```, but in SF3 both of these calls are deprecated.\r\n\r\nAre there any PRs to fix this? Because I couldn't find any, yet this seems a pretty big bug to me.And this is both on 3.x and master.\r\n\r\n\r\n## Expected results\r\n\r\nI think to solve it, add this to the controller\r\n\r\n```\r\n    /**\r\n     * @return Request\r\n     */\r\n    public function getRequest()\r\n    {\r\n            return $this->get('request_stack')->getCurrentRequest();\r\n    }\r\n```\r\n\r\nAnd replace ```$this->get('request')``` with ```$this->get('request_stack')```.\r\n\r\nThe alternative is to add ```(Request $request)``` to the controller parameters.\r\n"},"comment":{"url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/comments/229280007","html_url":"https://github.com/sonata-project/SonataMediaBundle/issues/1068#issuecomment-229280007","issue_url":"https://api.github.com/repos/sonata-project/SonataMediaBundle/issues/1068","id":229280007,"user":{"login":"clytemnestra","id":7060048,"avatar_url":"https://avatars.githubusercontent.com/u/7060048?v=3","gravatar_id":"","url":"https://api.github.com/users/clytemnestra","html_url":"https://github.com/clytemnestra","followers_url":"https://api.github.com/users/clytemnestra/followers","following_url":"https://api.github.com/users/clytemnestra/following{/other_user}","gists_url":"https://api.github.com/users/clytemnestra/gists{/gist_id}","starred_url":"https://api.github.com/users/clytemnestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clytemnestra/subscriptions","organizations_url":"https://api.github.com/users/clytemnestra/orgs","repos_url":"https://api.github.com/users/clytemnestra/repos","events_url":"https://api.github.com/users/clytemnestra/events{/privacy}","received_events_url":"https://api.github.com/users/clytemnestra/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T07:38:36Z","updated_at":"2016-06-29T07:38:36Z","body":"Should we replace all with ``$this->getRequest()`` with ``$this->get('request_stack')`` or should we also add the getRequest() function as well ?"}}
{"actor":{"display_login":"clytemnestra"}}