]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/TagController.php
User existing service instead of getDoctrine
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / TagController.php
index 9422bae43644b1796518d14ec5680661e4547fcd..72822479794efa8ce426c4ca72c364834a9217f0 100644 (file)
@@ -84,16 +84,17 @@ class TagController extends Controller
      */
     public function showTagAction()
     {
-        $tags = $this->getDoctrine()
-            ->getRepository('WallabagCoreBundle:Tag')
+        $repository = $this->get('wallabag_core.entry_repository');
+        $tags = $this->get('wallabag_core.tag_repository')
             ->findAllTags($this->getUser()->getId());
 
         $flatTags = [];
 
         foreach ($tags as $tag) {
-            $nbEntries = $this->getDoctrine()
-                ->getRepository('WallabagCoreBundle:Entry')
-                ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId());
+            $nbEntries = $repository->countAllEntriesByUserIdAndTagId(
+                $this->getUser()->getId(),
+                $tag->getId()
+            );
 
             $flatTags[] = [
                 'id' => $tag->getId(),
@@ -119,9 +120,10 @@ class TagController extends Controller
      */
     public function showEntriesForTagAction(Tag $tag, $page, Request $request)
     {
-        $entriesByTag = $this->getDoctrine()
-            ->getRepository('WallabagCoreBundle:Entry')
-            ->findAllByTagId($this->getUser()->getId(), $tag->getId());
+        $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId(
+            $this->getUser()->getId(),
+            $tag->getId()
+        );
 
         $pagerAdapter = new ArrayAdapter($entriesByTag);