aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/TagRepository.php
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-03-30 16:24:59 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2017-03-31 10:46:05 +0200
commit6da1aebc946e6448dd0d5080ee88e79c2bae4666 (patch)
tree43d350623f225ee560e040cd361d628454f2b1a7 /src/Wallabag/CoreBundle/Repository/TagRepository.php
parentfa884b30ba0f8cb4231bd37fff23ef2f41ae6cfa (diff)
downloadwallabag-6da1aebc946e6448dd0d5080ee88e79c2bae4666.tar.gz
wallabag-6da1aebc946e6448dd0d5080ee88e79c2bae4666.tar.zst
wallabag-6da1aebc946e6448dd0d5080ee88e79c2bae4666.zip
Allow to remove all archived entries
Since we still support fucking SQLite, we need to retrieve all tags & annotations for archived entries before deleting them. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/TagRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/TagRepository.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php
index 2182df25..b78e244e 100644
--- a/src/Wallabag/CoreBundle/Repository/TagRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php
@@ -76,4 +76,24 @@ class TagRepository extends EntityRepository
76 ->getQuery() 76 ->getQuery()
77 ->getSingleResult(); 77 ->getSingleResult();
78 } 78 }
79
80 public function findTagsForArchivedArticles($userId)
81 {
82 $ids = $this->createQueryBuilder('t')
83 ->select('t.id')
84 ->leftJoin('t.entries', 'e')
85 ->where('e.user = :userId')->setParameter('userId', $userId)
86 ->andWhere('e.isArchived = true')
87 ->groupBy('t.id')
88 ->orderBy('t.slug')
89 ->getQuery()
90 ->getArrayResult();
91
92 $tags = [];
93 foreach ($ids as $id) {
94 $tags[] = $this->find($id);
95 }
96
97 return $tags;
98 }
79} 99}