diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index 0db54a47a..4f6235930 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -213,17 +213,14 @@ class AccompanyingPeriodContext implements } } - $thirdParties = array_merge( - array_values(array_filter([$entity->getRequestorThirdParty()])), - array_values(array_filter( - array_map( - fn (Resource $r): ?ThirdParty => $r->getThirdParty(), - $entity->getResources()->filter( - static fn (Resource $r): bool => null !== $r->getThirdParty() - )->toArray() - ) - )) - ); + $thirdParties = [...array_values(array_filter([$entity->getRequestorThirdParty()])), ...array_values(array_filter( + array_map( + fn (Resource $r): ?ThirdParty => $r->getThirdParty(), + $entity->getResources()->filter( + static fn (Resource $r): bool => null !== $r->getThirdParty() + )->toArray() + ) + ))]; if ($options['thirdParty'] ?? false) { $builder->add('thirdParty', EntityType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index ee746a034..f58788120 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -116,20 +116,16 @@ class AccompanyingPeriodWorkEvaluationContext implements { $this->accompanyingPeriodWorkContext->buildPublicForm($builder, $template, $entity->getAccompanyingPeriodWork()); - $thirdParties = array_merge( - array_values(array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray())), - array_values(array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()])), - array_values( - array_filter( - array_map( - fn (Resource $r): ?ThirdParty => $r->getThirdParty(), - $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( - static fn (Resource $r): bool => null !== $r->getThirdParty() - )->toArray() - ) + $thirdParties = [...array_values(array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray())), ...array_values(array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()])), ...array_values( + array_filter( + array_map( + fn (Resource $r): ?ThirdParty => $r->getThirdParty(), + $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( + static fn (Resource $r): bool => null !== $r->getThirdParty() + )->toArray() ) ) - ); + )]; $options = $template->getOptions(); if ($options['thirdParty'] ?? false) { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php index 1ced31121..9d7f1cdd5 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php @@ -179,28 +179,25 @@ final class PersonContext implements PersonContextInterface 'data' => $this->translatableStringHelper->localize($template->getName()), ]); - $thirdParties = array_merge( - array_values( - array_filter( - array_map( - fn (ResidentialAddress $r): ?ThirdParty => $r->getHostThirdParty(), - $this - ->residentialAddressRepository - ->findCurrentResidentialAddressByPerson($entity) - ) - ) - ), - array_values( - array_filter( - array_map( - fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(), - $entity->getResources()->filter( - static fn (PersonResource $r): bool => null !== $r->getThirdParty() - )->toArray() - ) + $thirdParties = [...array_values( + array_filter( + array_map( + fn (ResidentialAddress $r): ?ThirdParty => $r->getHostThirdParty(), + $this + ->residentialAddressRepository + ->findCurrentResidentialAddressByPerson($entity) ) ) - ); + ), ...array_values( + array_filter( + array_map( + fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(), + $entity->getResources()->filter( + static fn (PersonResource $r): bool => null !== $r->getThirdParty() + )->toArray() + ) + ) + )]; if ($options['thirdParty'] ?? false) { $builder->add('thirdParty', EntityType::class, [