From d6b358cfa11bc5d41bdfe61e4c6924a76a7d5484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Nov 2022 13:14:48 +0100 Subject: [PATCH] Fixed: fix date's type in DateType input, and prevent collision on parameter name --- .../AccompanyingCourseFilters/HasNoReferrerFilter.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php index b18bcd1de..303c789af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasNoReferrerFilter.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory; use Chill\PersonBundle\Export\Declarations; -use DateTime; +use DateTimeImmutable; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -33,15 +33,15 @@ class HasNoReferrerFilter implements FilterInterface ->andWhere(' NOT EXISTS ( SELECT 1 FROM ' . UserHistory::class . ' uh - WHERE uh.startDate < :date + WHERE uh.startDate <= :has_no_referrer_filter_date AND ( uh.endDate IS NULL - or uh.endDate > :date + or uh.endDate > :has_no_referrer_filter_date ) AND uh.accompanyingPeriod = acp ) ') - ->setParameter('date', $data['calc_date'], Types::DATE_IMMUTABLE); + ->setParameter('has_no_referrer_filter_date', $data['calc_date'], Types::DATE_IMMUTABLE); } public function applyOn(): string @@ -54,7 +54,8 @@ class HasNoReferrerFilter implements FilterInterface $builder ->add('calc_date', ChillDateType::class, [ 'label' => 'Has no referrer on this date', - 'data' => new DateTime(), + 'data' => new DateTimeImmutable(), + 'input' => 'datetime_immutable', ]); }