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