]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
Add a real configuration for CS-Fixer
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Controller / WallabagV2Controller.php
index c2a42165b643b84cbf2c3f79ef1af46de3e289be..ab26400cfb1e445b2a5310a72df85139f5a44a0e 100644 (file)
@@ -8,26 +8,34 @@ use Symfony\Component\HttpFoundation\Request;
 class WallabagV2Controller extends WallabagController
 {
     /**
-     * {@inheritdoc}
+     * @Route("/wallabag-v2", name="import_wallabag_v2")
      */
-    protected function getImportService()
+    public function indexAction(Request $request)
     {
-        return $this->get('wallabag_import.wallabag_v2.import');
+        return parent::indexAction($request);
     }
 
     /**
      * {@inheritdoc}
      */
-    protected function getImportTemplate()
+    protected function getImportService()
     {
-        return 'WallabagImportBundle:WallabagV2:index.html.twig';
+        $service = $this->get('wallabag_import.wallabag_v2.import');
+
+        if ($this->get('craue_config')->get('import_with_rabbitmq')) {
+            $service->setProducer($this->get('old_sound_rabbit_mq.import_wallabag_v2_producer'));
+        } elseif ($this->get('craue_config')->get('import_with_redis')) {
+            $service->setProducer($this->get('wallabag_import.producer.redis.wallabag_v2'));
+        }
+
+        return $service;
     }
 
     /**
-     * @Route("/wallabag-v2", name="import_wallabag_v2")
+     * {@inheritdoc}
      */
-    public function indexAction(Request $request)
+    protected function getImportTemplate()
     {
-        return parent::indexAction($request);
+        return 'WallabagImportBundle:WallabagV2:index.html.twig';
     }
 }