diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index efc005be0..ba4eaf6b8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -52,18 +52,10 @@ class SocialWorkTypeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $where = $qb->getDQLPart('where'); - if (count($data['actionType']) > 0) { - $clause = $qb->expr()->in('acpw.socialAction', ':actionType'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->setParameter('actionType', $data['actionType']); + $qb + ->andWhere($qb->expr()->in('acpw.socialAction', ':actionType')) + ->setParameter('actionType', $data['actionType']); } if (count($data['goal']) > 0) { @@ -71,11 +63,9 @@ class SocialWorkTypeFilter implements FilterInterface $qb->join('acpw.goals', 'goal'); } - $where->add( - $qb->expr()->in('goal.id', ':goals') - ); - - $qb->setParameter('goals', $data['goal']); + $qb + ->andWhere($qb->expr()->in('goal.id', ':goals')) + ->setParameter('goals', $data['goal']); } if (count($data['result']) > 0) { @@ -83,14 +73,10 @@ class SocialWorkTypeFilter implements FilterInterface $qb->join('acpw.results', 'result'); } - $where->add( - $qb->expr()->in('result.id', ':results') - ); - - $qb->setParameter('results', $data['result']); + $qb + ->andWhere($qb->expr()->in('result.id', ':results')) + ->setParameter('results', $data['result']); } - - $qb->add('where', $where); } public function applyOn(): string