mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 21:16:13 +00:00
Fixed: [export] query in goal and results filter
https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/700
This commit is contained in:
parent
d1e8e6c18e
commit
d893e3a664
@ -19,7 +19,6 @@ use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
@ -59,23 +58,31 @@ class SocialWorkTypeFilter implements FilterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count($data['goal']) > 0) {
|
if (count($data['goal']) > 0) {
|
||||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
if (!in_array('acpw_goal', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.goals', 'goal');
|
$qb->join('acpw.goals', 'acpw_goal');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb
|
$orX = $qb->expr()->orX();
|
||||||
->andWhere($qb->expr()->in('goal.id', ':goals'))
|
foreach ($data['goal'] as $goal) {
|
||||||
->setParameter('goals', $data['goal']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($data['result']) > 0) {
|
/** @var Goal $goal */
|
||||||
if (!in_array('result', $qb->getAllAliases(), true)) {
|
$andX = $qb->expr()->andX();
|
||||||
$qb->join('acpw.results', 'result');
|
$andX->add($qb->expr()->eq('acpw_goal.goal', $goalId = ':goal_'.uniqid()));
|
||||||
|
$qb->setParameter($goalId, $goal);
|
||||||
|
|
||||||
|
if (count($data['result']) > 0) {
|
||||||
|
$orXResult = $qb->expr()->orX();
|
||||||
|
foreach ($data['result'] as $result) {
|
||||||
|
|
||||||
|
/** @var Result $result */
|
||||||
|
$orXResult->add($qb->expr()->isMemberOf($resultId = ':result_'.uniqid(), 'acpw_goal.results'));
|
||||||
|
$qb->setParameter($resultId, $result);
|
||||||
|
}
|
||||||
|
$andX->add($orXResult);
|
||||||
|
}
|
||||||
|
$orX->add($andX);
|
||||||
}
|
}
|
||||||
|
$qb->andWhere($orX);
|
||||||
$qb
|
|
||||||
->andWhere($qb->expr()->in('result.id', ':results'))
|
|
||||||
->setParameter('results', $data['result']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user