mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
simplify alterquery
This commit is contained in:
parent
896b4cdfe3
commit
d1e8e6c18e
@ -52,18 +52,10 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
|
||||||
|
|
||||||
if (count($data['actionType']) > 0) {
|
if (count($data['actionType']) > 0) {
|
||||||
$clause = $qb->expr()->in('acpw.socialAction', ':actionType');
|
$qb
|
||||||
|
->andWhere($qb->expr()->in('acpw.socialAction', ':actionType'))
|
||||||
if ($where instanceof Andx) {
|
->setParameter('actionType', $data['actionType']);
|
||||||
$where->add($clause);
|
|
||||||
} else {
|
|
||||||
$where = $qb->expr()->andX($clause);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->setParameter('actionType', $data['actionType']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($data['goal']) > 0) {
|
if (count($data['goal']) > 0) {
|
||||||
@ -71,11 +63,9 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
$qb->join('acpw.goals', 'goal');
|
$qb->join('acpw.goals', 'goal');
|
||||||
}
|
}
|
||||||
|
|
||||||
$where->add(
|
$qb
|
||||||
$qb->expr()->in('goal.id', ':goals')
|
->andWhere($qb->expr()->in('goal.id', ':goals'))
|
||||||
);
|
->setParameter('goals', $data['goal']);
|
||||||
|
|
||||||
$qb->setParameter('goals', $data['goal']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($data['result']) > 0) {
|
if (count($data['result']) > 0) {
|
||||||
@ -83,14 +73,10 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
$qb->join('acpw.results', 'result');
|
$qb->join('acpw.results', 'result');
|
||||||
}
|
}
|
||||||
|
|
||||||
$where->add(
|
$qb
|
||||||
$qb->expr()->in('result.id', ':results')
|
->andWhere($qb->expr()->in('result.id', ':results'))
|
||||||
);
|
->setParameter('results', $data['result']);
|
||||||
|
|
||||||
$qb->setParameter('results', $data['result']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->add('where', $where);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user