From 31a3e44d704021990faad05706f75d0204e88925 Mon Sep 17 00:00:00 2001 From: "Nathanael d. Noblet" Date: Thu, 18 Feb 2016 14:50:25 -0700 Subject: [PATCH] injected request into controller action --- Controller/TranslateController.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Controller/TranslateController.php b/Controller/TranslateController.php index 5b653d8e..bed25784 100644 --- a/Controller/TranslateController.php +++ b/Controller/TranslateController.php @@ -25,6 +25,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\HttpFoundation\Request; /** * Translate Controller. @@ -33,9 +34,6 @@ */ class TranslateController { - /** @DI\Inject */ - private $request; - /** @DI\Inject("jms_translation.config_factory") */ private $configFactory; @@ -51,12 +49,13 @@ class TranslateController /** * @Route("/", name="jms_translation_index", options = {"i18n" = false}) * @Template + * @param Request $request * @return array */ - public function indexAction() + public function indexAction(Request $request) { $configs = $this->configFactory->getNames(); - $config = $this->request->query->get('config') ?: reset($configs); + $config = $request->query->get('config') ?: reset($configs); if (!$config) { throw new RuntimeException('You need to configure at least one config under "jms_translation.configs".'); } @@ -68,7 +67,7 @@ public function indexAction() } $domains = array_keys($files); - if ((!$domain = $this->request->query->get('domain')) || !isset($files[$domain])) { + if ((!$domain = $request->query->get('domain')) || !isset($files[$domain])) { $domain = reset($domains); } @@ -76,7 +75,7 @@ public function indexAction() natsort($locales); - if ((!$locale = $this->request->query->get('locale')) || !isset($files[$domain][$locale])) { + if ((!$locale = $request->query->get('locale')) || !isset($files[$domain][$locale])) { $locale = reset($locales); }