1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-20 19:52:09 +00:00

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>
This commit is contained in:
Thomas Citharel 2017-03-30 16:24:59 +02:00 committed by Nicolas Lœuillet
parent fa884b30ba
commit 6da1aebc94
18 changed files with 205 additions and 1 deletions

View file

@ -371,4 +371,12 @@ class EntryRepository extends EntityRepository
->setParameter('userId', $userId)
->execute();
}
public function removeArchivedByUserId($userId)
{
$this->getEntityManager()
->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId AND e.isArchived = TRUE')
->setParameter('userId', $userId)
->execute();
}
}

View 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;
}
}