Added route to list entries with annotations

This commit is contained in:
Nicolas Lœuillet
2020-04-20 19:00:58 +02:00
committed by Jeremy Benoist
parent 9a6146d2ef
commit dce50ddb79
23 changed files with 143 additions and 4 deletions

View File

@ -142,6 +142,21 @@ class EntryRepository extends EntityRepository
return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId));
}
/**
* Retrieve entries with annotations for a user.
*
* @param int $userId
*
* @return QueryBuilder
*/
public function getBuilderForAnnotationsByUser($userId)
{
return $this
->getSortedQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
}
/**
* Retrieve untagged entries for a user.
*
@ -579,6 +594,10 @@ class EntryRepository extends EntityRepository
$qb->leftJoin('e.tags', 't');
$qb->andWhere('t.id is null');
break;
case 'with_annotations':
$qb->leftJoin('e.annotations', 'a');
$qb->andWhere('a.id is not null');
break;
}
$ids = $qb->getQuery()->getArrayResult();