diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index ec4a5abe7..996ff36e3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Evaluation; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr\Andx; +use Chill\PersonBundle\Repository\SocialWork\EvaluationRepositoryInterface; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; @@ -23,11 +23,15 @@ use function in_array; class EvaluationFilter implements FilterInterface { + private EvaluationRepositoryInterface $evaluationRepository; + private TranslatableStringHelper $translatableStringHelper; public function __construct( + EvaluationRepositoryInterface $evaluationRepository, TranslatableStringHelper $translatableStringHelper ) { + $this->evaluationRepository = $evaluationRepository; $this->translatableStringHelper = $translatableStringHelper; } @@ -50,16 +54,8 @@ class EvaluationFilter implements FilterInterface $qb->join('workeval.evaluation', 'eval'); } - $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('eval.id', ':evaluations'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); + $qb->andWhere($clause); $qb->setParameter('evaluations', $data['accepted_evaluations']); } @@ -72,11 +68,13 @@ class EvaluationFilter implements FilterInterface { $builder->add('accepted_evaluations', EntityType::class, [ 'class' => Evaluation::class, + 'choices' => $this->evaluationRepository->findAllActive(), 'choice_label' => function (Evaluation $ev) { return $this->translatableStringHelper->localize($ev->getTitle()); }, 'multiple' => true, - 'expanded' => true, + 'expanded' => false, + 'attr' => ['class' => 'select2'], ]); }