X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FTagRepository.php;h=6c63a6a2792e8f276d49b098eed055c688834d8e;hb=873f6b8e03079d11fab541aa5b0bc6f8fe2d645e;hp=2182df254315b9341448f01ba7191bfc50eed7e1;hpb=eef47c0ead8e7aa754f5160d077aaaa9f16937c9;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 2182df25..6c63a6a2 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -76,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; + } }