diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-10 12:33:58 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-21 11:44:35 +0200 |
commit | 25203e5081c8da21869db1d16610f83f888249b5 (patch) | |
tree | 3e6f460b2e7d5e745113bbdfca3e2b2bc566a7d8 /src/Wallabag/CoreBundle/Controller/TagController.php | |
parent | 80784b782becfaa297e6d9cbb0584e27739cffc8 (diff) | |
download | wallabag-25203e5081c8da21869db1d16610f83f888249b5.tar.gz wallabag-25203e5081c8da21869db1d16610f83f888249b5.tar.zst wallabag-25203e5081c8da21869db1d16610f83f888249b5.zip |
User existing service instead of getDoctrine
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/TagController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/TagController.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 9422bae4..72822479 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -84,16 +84,17 @@ class TagController extends Controller | |||
84 | */ | 84 | */ |
85 | public function showTagAction() | 85 | public function showTagAction() |
86 | { | 86 | { |
87 | $tags = $this->getDoctrine() | 87 | $repository = $this->get('wallabag_core.entry_repository'); |
88 | ->getRepository('WallabagCoreBundle:Tag') | 88 | $tags = $this->get('wallabag_core.tag_repository') |
89 | ->findAllTags($this->getUser()->getId()); | 89 | ->findAllTags($this->getUser()->getId()); |
90 | 90 | ||
91 | $flatTags = []; | 91 | $flatTags = []; |
92 | 92 | ||
93 | foreach ($tags as $tag) { | 93 | foreach ($tags as $tag) { |
94 | $nbEntries = $this->getDoctrine() | 94 | $nbEntries = $repository->countAllEntriesByUserIdAndTagId( |
95 | ->getRepository('WallabagCoreBundle:Entry') | 95 | $this->getUser()->getId(), |
96 | ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); | 96 | $tag->getId() |
97 | ); | ||
97 | 98 | ||
98 | $flatTags[] = [ | 99 | $flatTags[] = [ |
99 | 'id' => $tag->getId(), | 100 | 'id' => $tag->getId(), |
@@ -119,9 +120,10 @@ class TagController extends Controller | |||
119 | */ | 120 | */ |
120 | public function showEntriesForTagAction(Tag $tag, $page, Request $request) | 121 | public function showEntriesForTagAction(Tag $tag, $page, Request $request) |
121 | { | 122 | { |
122 | $entriesByTag = $this->getDoctrine() | 123 | $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId( |
123 | ->getRepository('WallabagCoreBundle:Entry') | 124 | $this->getUser()->getId(), |
124 | ->findAllByTagId($this->getUser()->getId(), $tag->getId()); | 125 | $tag->getId() |
126 | ); | ||
125 | 127 | ||
126 | $pagerAdapter = new ArrayAdapter($entriesByTag); | 128 | $pagerAdapter = new ArrayAdapter($entriesByTag); |
127 | 129 | ||