mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
add a filtering of tasks by center
This commit is contained in:
@@ -8,6 +8,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
|
||||
/**
|
||||
* SingleTaskRepository
|
||||
@@ -107,6 +108,14 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
|
||||
if (\array_key_exists('person', $params) and !empty($params['person'])) {
|
||||
$qb->andWhere($qb->expr()->eq('st.person', ':person'));
|
||||
$qb->setParameter('person', $params['person']);
|
||||
} elseif (\array_key_exists('center', $params)) {
|
||||
if ($params['center'] instanceof Center) {
|
||||
$qb->join('st.person', 'person');
|
||||
$qb->andWhere($qb->expr()->eq('person.center', ':center'));
|
||||
$qb->setParameter('center', $params['center']);
|
||||
} else {
|
||||
throw new \UnexpectedValueException("params 'center' should be an instance of ".Center::class);
|
||||
}
|
||||
}
|
||||
|
||||
if (\array_key_exists('unassigned', $params) and $params['unassigned'] === true) {
|
||||
@@ -142,7 +151,7 @@ class SingleTaskRepository extends \Doctrine\ORM\EntityRepository
|
||||
if (\array_key_exists('is_closed', $params)) {
|
||||
$qb->andWhere($this->buildIsClosed($qb, !$params['is_closed']));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function addTypeFilter(QueryBuilder $qb, $params)
|
||||
|
Reference in New Issue
Block a user