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

@ -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();
}
}