chill-bundles#25: replace ChillDateType by PickRollingDateType

batch/serial replacing
untested
This commit is contained in:
2022-11-14 15:38:14 +01:00
parent 1f3dd00d81
commit 68bfb082fc
31 changed files with 512 additions and 251 deletions

View File

@@ -12,10 +12,10 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator\HouseholdAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -26,10 +26,14 @@ class ChildrenNumberAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
TranslatorInterface $translator
TranslatorInterface $translator,
RollingDateConverterInterface $rollingDateConverter
) {
$this->translator = $translator;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string
@@ -55,7 +59,9 @@ class ChildrenNumberAggregator implements AggregatorInterface
->addSelect('composition_children.numberOfChildren AS childrennumber_aggregator')
->addGroupBy('childrennumber_aggregator');
$qb->setParameter('ondate_composition_children', $data['on_date'], Types::DATE_MUTABLE);
$qb->setParameter('ondate_composition_children',
$this->rollingDateConverter->convert($data['on_date'])
);
}
public function applyOn(): string
@@ -65,8 +71,8 @@ class ChildrenNumberAggregator implements AggregatorInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('on_date', ChillDateType::class, [
'data' => new DateTime('now'),
$builder->add('on_date', PickRollingDateType::class, [
'data' => new RollingDate(RollingDate::T_TODAY),
]);
}

View File

@@ -12,12 +12,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator\HouseholdAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepository;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@@ -29,12 +29,16 @@ class CompositionAggregator implements AggregatorInterface
private HouseholdCompositionTypeRepository $typeRepository;
private RollingDateConverterInterface $rollingDateConverter;
public function __construct(
HouseholdCompositionTypeRepository $typeRepository,
TranslatableStringHelper $translatableStringHelper
TranslatableStringHelper $translatableStringHelper,
RollingDateConverterInterface $rollingDateConverter
) {
$this->typeRepository = $typeRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->rollingDateConverter = $rollingDateConverter;
}
public function addRole(): ?string
@@ -60,7 +64,9 @@ class CompositionAggregator implements AggregatorInterface
->addSelect('IDENTITY(composition_type.householdCompositionType) AS composition_aggregator')
->addGroupBy('composition_aggregator');
$qb->setParameter('ondate_composition_type', $data['on_date'], Types::DATE_MUTABLE);
$qb->setParameter('ondate_composition_type',
$this->rollingDateConverter->convert($data['on_date'])
);
}
public function applyOn(): string
@@ -70,8 +76,8 @@ class CompositionAggregator implements AggregatorInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('on_date', ChillDateType::class, [
'data' => new DateTime('now'),
$builder->add('on_date', PickRollingDateType::class, [
'data' => new RollingDate(RollingDate::T_TODAY),
]);
}