]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/TagRepository.php
Allow to remove all archived entries
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / TagRepository.php
index 2182df254315b9341448f01ba7191bfc50eed7e1..b78e244ecda63d1ca8834768f1602cb82cbe3488 100644 (file)
@@ -76,4 +76,24 @@ class TagRepository extends EntityRepository
             ->getQuery()
             ->getSingleResult();
     }
+
+    public function findTagsForArchivedArticles($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;
+    }
 }