X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FTagRepository.php;h=6c63a6a2792e8f276d49b098eed055c688834d8e;hb=873f6b8e03079d11fab541aa5b0bc6f8fe2d645e;hp=81445989b71c97fc06a13e22f8aaada1b81d871d;hpb=1f00547836d1e832b31368413dccb32586206321;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 81445989..6c63a6a2 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -49,6 +49,7 @@ class TagRepository extends EntityRepository ->leftJoin('t.entries', 'e') ->where('e.user = :userId')->setParameter('userId', $userId) ->groupBy('t.id') + ->orderBy('t.slug') ->getQuery() ->getArrayResult(); @@ -75,4 +76,24 @@ class TagRepository extends EntityRepository ->getQuery() ->getSingleResult(); } + + public function findForArchivedArticlesByUser($userId) + { + $ids = $this->createQueryBuilder('t') + ->select('t.id') + ->leftJoin('t.entries', 'e') + ->where('e.user = :userId')->setParameter('userId', $userId) + ->andWhere('e.isArchived = true') + ->groupBy('t.id') + ->orderBy('t.slug') + ->getQuery() + ->getArrayResult(); + + $tags = []; + foreach ($ids as $id) { + $tags[] = $this->find($id); + } + + return $tags; + } }