X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FTagController.php;h=a3e70fd0aeabf2661d15560b1e40142836fd2357;hb=5a619812ca3eb05a82a023ccdaee13501eb8d45f;hp=c5746734d398fd2653a64ade83d66d150acbbafe;hpb=93a95c09bf7ab389de623f6cda01dfc295aa6b74;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index c5746734..a3e70fd0 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -86,10 +86,25 @@ class TagController extends Controller { $tags = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Tag') - ->findAllTagsWithEntries($this->getUser()->getId()); + ->findAllTags($this->getUser()->getId()); + + $flatTags = []; + + foreach ($tags as $tag) { + $nbEntries = $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); + + $flatTags[] = [ + 'id' => $tag->getId(), + 'label' => $tag->getLabel(), + 'slug' => $tag->getSlug(), + 'nbEntries' => $nbEntries, + ]; + } return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [ - 'tags' => $tags, + 'tags' => $flatTags, ]); } @@ -128,6 +143,7 @@ class TagController extends Controller 'form' => null, 'entries' => $entries, 'currentPage' => $page, + 'tag' => $tag->getLabel(), ]); } }