From 7ae56a67479bf5ba31314230a60d866964ab58a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 5 Jun 2018 11:48:23 +0200 Subject: [PATCH] add filtering by task type --- Repository/SingleTaskRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Repository/SingleTaskRepository.php b/Repository/SingleTaskRepository.php index f2bbd06c3..02a5bda51 100644 --- a/Repository/SingleTaskRepository.php +++ b/Repository/SingleTaskRepository.php @@ -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'])); + } }