aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-10-09 21:27:47 +0200
committerGitHub <noreply@github.com>2016-10-09 21:27:47 +0200
commit47508f004fe9a17a8012187f37032f4155d507f4 (patch)
tree69e089f1bafa49a553b28cf2aefc4f5c0192697d /src/Wallabag/CoreBundle/Controller
parente39aec3e38144f1a2ddb0027ec724e3dfd6f53f1 (diff)
parente08477803079d0097885e026797256da7fd30f6c (diff)
downloadwallabag-47508f004fe9a17a8012187f37032f4155d507f4.tar.gz
wallabag-47508f004fe9a17a8012187f37032f4155d507f4.tar.zst
wallabag-47508f004fe9a17a8012187f37032f4155d507f4.zip
Merge pull request #2410 from wallabag/tag-optim
Optimize tag list display
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index c5746734..5acc6852 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -86,10 +86,25 @@ class TagController extends Controller
86 { 86 {
87 $tags = $this->getDoctrine() 87 $tags = $this->getDoctrine()
88 ->getRepository('WallabagCoreBundle:Tag') 88 ->getRepository('WallabagCoreBundle:Tag')
89 ->findAllTagsWithEntries($this->getUser()->getId()); 89 ->findAllTags($this->getUser()->getId());
90
91 $flatTags = [];
92
93 foreach ($tags as $key => $tag) {
94 $nbEntries = $this->getDoctrine()
95 ->getRepository('WallabagCoreBundle:Entry')
96 ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']);
97
98 $flatTags[] = [
99 'id' => $tag['id'],
100 'label' => $tag['label'],
101 'slug' => $tag['slug'],
102 'nbEntries' => $nbEntries,
103 ];
104 }
90 105
91 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ 106 return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
92 'tags' => $tags, 107 'tags' => $flatTags,
93 ]); 108 ]);
94 } 109 }
95 110