mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
DX: prevent collision in parameter name in evaluation / by start date filter
This commit is contained in:
parent
63d38e35f7
commit
d8104c4443
@ -14,7 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\EvaluationFilters;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use DateTime;
|
use DateTimeImmutable;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -26,12 +26,12 @@ class ByStartDateFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->andWhere('workeval.startDate IS BETWEEN :start_date and :end_date')
|
->andWhere('workeval.startDate BETWEEN :work_eval_by_start_date_start_date and :work_eval_by_start_date_end_date')
|
||||||
->setParameter('start_date', $data['start_date'], Types::DATE_IMMUTABLE)
|
->setParameter('work_eval_by_start_date_start_date', $data['start_date'], Types::DATE_IMMUTABLE)
|
||||||
->setParameter('end_date', $data['end_date'], Types::DATE_IMMUTABLE);
|
->setParameter('work_eval_by_start_date_end_date', $data['end_date'], Types::DATE_IMMUTABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -39,16 +39,18 @@ class ByStartDateFilter implements FilterInterface
|
|||||||
return Declarations::EVAL_TYPE;
|
return Declarations::EVAL_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('start_date', ChillDateType::class, [
|
->add('start_date', ChillDateType::class, [
|
||||||
'label' => 'start period date',
|
'label' => 'start period date',
|
||||||
'data' => new DateTime(),
|
'data' => new DateTimeImmutable('1 year ago'),
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
])
|
])
|
||||||
->add('end_date', ChillDateType::class, [
|
->add('end_date', ChillDateType::class, [
|
||||||
'label' => 'end period date',
|
'label' => 'end period date',
|
||||||
'data' => new DateTime(),
|
'data' => new DateTimeImmutable(),
|
||||||
|
'input' => 'datetime_immutable',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user