Feature: add thirdParty choice in docgen context - use array_values

This commit is contained in:
nobohan 2023-05-25 13:58:46 +02:00
parent 9593cfde36
commit 1b0569c974
3 changed files with 31 additions and 23 deletions

View File

@ -214,8 +214,9 @@ class AccompanyingPeriodContext implements
} }
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter([$entity->getRequestorThirdParty()]), array_filter(array_values([$entity->getRequestorThirdParty()])),
array_filter( array_filter(
array_values(
array_map( array_map(
fn (Resource $r): ?ThirdParty => $r->getThirdParty(), fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getResources()->filter( $entity->getResources()->filter(
@ -223,6 +224,7 @@ class AccompanyingPeriodContext implements
)->toArray() )->toArray()
) )
) )
)
); );
if ($options['thirdParty'] ?? false) { if ($options['thirdParty'] ?? false) {

View File

@ -117,9 +117,10 @@ class AccompanyingPeriodWorkEvaluationContext implements
$this->accompanyingPeriodWorkContext->buildPublicForm($builder, $template, $entity->getAccompanyingPeriodWork()); $this->accompanyingPeriodWorkContext->buildPublicForm($builder, $template, $entity->getAccompanyingPeriodWork());
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray()), array_filter(array_values($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray())),
array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()]), array_filter(array_values([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()])),
array_filter( array_filter(
array_values(
array_map( array_map(
fn (Resource $r): ?ThirdParty => $r->getThirdParty(), fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter(
@ -127,6 +128,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
)->toArray() )->toArray()
) )
) )
)
); );
$options = $template->getOptions(); $options = $template->getOptions();

View File

@ -178,14 +178,17 @@ final class PersonContext implements PersonContextInterface
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter( array_filter(
array_values(
array_map( array_map(
fn (ResidentialAddress $r): ?ThirdParty => $r->getHostThirdParty(), fn (ResidentialAddress $r): ?ThirdParty => $r->getHostThirdParty(),
$this $this
->residentialAddressRepository ->residentialAddressRepository
->findCurrentResidentialAddressByPerson($entity) ->findCurrentResidentialAddressByPerson($entity)
) )
)
), ),
array_filter( array_filter(
array_values(
array_map( array_map(
fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(), fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getResources()->filter( $entity->getResources()->filter(
@ -193,6 +196,7 @@ final class PersonContext implements PersonContextInterface
)->toArray() )->toArray()
) )
) )
)
); );
if ($options['thirdParty'] ?? false) { if ($options['thirdParty'] ?? false) {