From 6da1aebc946e6448dd0d5080ee88e79c2bae4666 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 30 Mar 2017 16:24:59 +0200 Subject: 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 --- .../AnnotationBundle/Repository/AnnotationRepository.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Wallabag/AnnotationBundle/Repository') diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 8d3f07ee..23f21c3e 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -122,4 +122,20 @@ class AnnotationRepository extends EntityRepository ->setParameter('userId', $userId) ->execute(); } + + /** + * Find all annotations related to archived entries + * + * @param $userId + * @return mixed + */ + public function findAllByArchivedEntriesAndUserId($userId) + { + return $this->createQueryBuilder('a') + ->leftJoin('a.entry', 'e') + ->where('a.user = :userid')->setParameter(':userid', $userId) + ->andWhere('e.isArchived = true') + ->getQuery() + ->getResult(); + } } -- cgit v1.2.3