add filtering by task type

This commit is contained in:
Julien Fastré 2018-06-05 11:48:23 +02:00
parent 145e099903
commit 7ae56a6747

View File

@ -73,6 +73,7 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
* `ended`, `warning`, `current`, `not_started` ;
* - `is_closed`: boolean. Indicate if the tasks must be closed (true) or
* opened
* - `types`: string[] an array of task types
*
* @param type $params
* @param User $currentUser
@ -134,7 +135,10 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
if (\array_key_exists('is_closed', $params)) {
$qb->andWhere($this->buildIsClosed($qb, !$params['is_closed']));
}
if (\array_key_exists('types', $params) && count($params['types']) > 0) {
$qb->andWhere($qb->expr()->in('st.type', $params['types']));
}
}