+
+ /**
+ * Find all annotations related to archived entries.
+ *
+ * @param $userId
+ *
+ * @return mixed
+ */
+ public function findAllArchivedEntriesByUser($userId)
+ {
+ return $this->createQueryBuilder('a')
+ ->leftJoin('a.entry', 'e')
+ ->where('a.user = :userid')->setParameter(':userid', $userId)
+ ->andWhere('e.isArchived = true')
+ ->getQuery()
+ ->getResult();
+ }
+
+ /**
+ * Return a query builder to used by other getBuilderFor* method.
+ *
+ * @param int $userId
+ *
+ * @return QueryBuilder
+ */
+ private function getBuilderByUser($userId)
+ {
+ return $this->createQueryBuilder('a')
+ ->leftJoin('a.user', 'u')
+ ->andWhere('u.id = :userId')->setParameter('userId', $userId)
+ ->orderBy('a.id', 'desc')
+ ;
+ }