X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FTagController.php;h=4542d484c3a2a9e9aaf4b003109e0d068860c2ec;hb=64a8781e453c40ff144d03405abe2dc1ccfacbe0;hp=c5746734d398fd2653a64ade83d66d150acbbafe;hpb=e07c25a1adb2f89c5f57656e24a054ddd3a45df7;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index c5746734..4542d484 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, ]); }