mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Export: fix usage of some Collection returned instead of array in export filters
This commit is contained in:
parent
2883e085ed
commit
d0bceb59dc
5
.changes/unreleased/Fixed-20231120-181130.yaml
Normal file
5
.changes/unreleased/Fixed-20231120-181130.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'Export: fix usage of some Collection returned instead of array in export filters'
|
||||||
|
time: 2023-11-20T18:11:30.290242917+01:00
|
||||||
|
custom:
|
||||||
|
Issue: "213"
|
@ -70,7 +70,7 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
return static function ($value): string {
|
return static function (int|string|null $value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'Number of children';
|
return 'Number of children';
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ class ChildrenNumberAggregator implements AggregatorInterface
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return (string) $value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -59,7 +60,13 @@ class CreatorFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Filtered by creator: only %creators%', [
|
'Filtered by creator: only %creators%', [
|
||||||
'%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['accepted_creators'])),
|
'%creators%' => implode(
|
||||||
|
', ',
|
||||||
|
array_map(
|
||||||
|
static fn (User $u) => $u->getLabel(),
|
||||||
|
$data['accepted_creators'] instanceof Collection ? $data['accepted_creators']->toArray() : $data['accepted_creators']
|
||||||
|
)
|
||||||
|
),
|
||||||
], ];
|
], ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -68,7 +69,10 @@ class GeographicalUnitStatFilter implements FilterInterface
|
|||||||
'acp_geog_filter_date',
|
'acp_geog_filter_date',
|
||||||
$this->rollingDateConverter->convert($data['date_calc'])
|
$this->rollingDateConverter->convert($data['date_calc'])
|
||||||
)
|
)
|
||||||
->setParameter('acp_geog_filter_units', array_map(static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id, $data['units']));
|
->setParameter('acp_geog_filter_units', array_map(
|
||||||
|
static fn (SimpleGeographicalUnitDTO $unitDTO) => $unitDTO->id,
|
||||||
|
$data['units'] instanceof Collection ? $data['units']->toArray() : $data['units']
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -16,6 +16,7 @@ use Chill\PersonBundle\Export\Declarations;
|
|||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
||||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -52,7 +53,10 @@ final readonly class HandlingThirdPartyFilter implements FilterInterface
|
|||||||
[
|
[
|
||||||
'%3parties%' => implode(
|
'%3parties%' => implode(
|
||||||
', ',
|
', ',
|
||||||
array_map(fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []), $data['handling_3parties'])
|
array_map(
|
||||||
|
fn (ThirdParty $thirdParty) => $this->thirdPartyRender->renderString($thirdParty, []),
|
||||||
|
$data['handling_3parties'] instanceof Collection ? $data['handling_3parties']->toArray() : $data['handling_3parties']
|
||||||
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -21,6 +21,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -115,7 +116,7 @@ readonly class JobWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (UserJob $userJob) => $this->translatableStringHelper->localize($userJob->getLabel()),
|
fn (UserJob $userJob) => $this->translatableStringHelper->localize($userJob->getLabel()),
|
||||||
$data['jobs']
|
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
@ -21,6 +21,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodInfo;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -110,7 +111,7 @@ readonly class ScopeWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (Scope $scope) => $this->translatableStringHelper->localize($scope->getName()),
|
fn (Scope $scope) => $this->translatableStringHelper->localize($scope->getName()),
|
||||||
$data['scopes']
|
$data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -98,7 +99,10 @@ class StepFilterBetweenDates implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']);
|
$steps = array_map(
|
||||||
|
fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]),
|
||||||
|
$data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi']
|
||||||
|
);
|
||||||
|
|
||||||
return ['export.filter.course.by_step.Filtered by steps: only %step% and between %date_from% and %date_to%', [
|
return ['export.filter.course.by_step.Filtered by steps: only %step% and between %date_from% and %date_to%', [
|
||||||
'%step%' => implode(', ', $steps),
|
'%step%' => implode(', ', $steps),
|
||||||
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
|||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -101,7 +102,10 @@ class StepFilterOnDate implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$steps = array_map(fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]), $data['accepted_steps_multi']);
|
$steps = array_map(
|
||||||
|
fn (string $step) => $this->translator->trans(array_flip(self::STEPS)[$step]),
|
||||||
|
$data['accepted_steps_multi'] instanceof Collection ? $data['accepted_steps_multi']->toArray() : $data['accepted_steps_multi']
|
||||||
|
);
|
||||||
|
|
||||||
return ['Filtered by steps: only %step%', [
|
return ['Filtered by steps: only %step%', [
|
||||||
'%step%' => implode(', ', $steps),
|
'%step%' => implode(', ', $steps),
|
||||||
|
@ -20,6 +20,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ final readonly class UserWorkingOnCourseFilter implements FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (User $u) => $this->userRender->renderString($u, []),
|
fn (User $u) => $this->userRender->renderString($u, []),
|
||||||
$data['users']
|
$data['users'] instanceof Collection ? $data['users']->toArray() : $data['users']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
'%start_date%' => $this->rollingDateConverter->convert($data['start_date'])?->format('d-m-Y'),
|
||||||
|
@ -21,6 +21,7 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
|||||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface;
|
use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepositoryInterface;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@ -84,7 +85,7 @@ class ByHouseholdCompositionFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$compos = array_map(
|
$compos = array_map(
|
||||||
fn (HouseholdCompositionType $compositionType) => $this->translatableStringHelper->localize($compositionType->getLabel()),
|
fn (HouseholdCompositionType $compositionType) => $this->translatableStringHelper->localize($compositionType->getLabel()),
|
||||||
$data['compositions']->toArray()
|
$data['compositions'] instanceof Collection ? $data['compositions']->toArray() : $data['compositions']
|
||||||
);
|
);
|
||||||
|
|
||||||
return ['export.filter.person.by_composition.Filtered by composition at %date%: only %compositions%', [
|
return ['export.filter.person.by_composition.Filtered by composition at %date%: only %compositions%', [
|
||||||
|
@ -20,6 +20,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -102,7 +103,7 @@ class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface
|
|||||||
', ',
|
', ',
|
||||||
array_map(
|
array_map(
|
||||||
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()).' > '.$item->unitName,
|
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()).' > '.$item->unitName,
|
||||||
$data['units']
|
$data['units'] instanceof Collection ? $data['units']->toArray() : $data['units']
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
@ -55,7 +56,13 @@ class CreatorFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'export.filter.work.by_creator.Filtered by creator: only %creators%', [
|
'export.filter.work.by_creator.Filtered by creator: only %creators%', [
|
||||||
'%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['creators'])),
|
'%creators%' => implode(
|
||||||
|
', ',
|
||||||
|
array_map(
|
||||||
|
static fn (User $u) => $u->getLabel(),
|
||||||
|
$data['creators'] instanceof Collection ? $data['creators']->toArray() : $data['creators']
|
||||||
|
)
|
||||||
|
),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user