- $tags = $this->getDoctrine()
- ->getRepository('WallabagCoreBundle:Tag')
- ->findAllTagsWithEntries($this->getUser()->getId());
+ $repository = $this->get('wallabag_core.entry_repository');
+ $tags = $this->get('wallabag_core.tag_repository')
+ ->findAllTags($this->getUser()->getId());
+
+ $flatTags = [];
+
+ foreach ($tags as $tag) {
+ $nbEntries = $repository->countAllEntriesByUserIdAndTagId(
+ $this->getUser()->getId(),
+ $tag->getId()
+ );
+
+ $flatTags[] = [
+ 'id' => $tag->getId(),
+ 'label' => $tag->getLabel(),
+ 'slug' => $tag->getSlug(),
+ 'nbEntries' => $nbEntries,
+ ];
+ }