Feature: add thirdParty choice in docgen accperiodworkevaluation context - phpcs fix

This commit is contained in:
nobohan 2023-05-25 09:59:16 +02:00
parent 303666b30d
commit ef59e6dc1c
6 changed files with 18 additions and 16 deletions

View File

@ -650,8 +650,8 @@ final class ActivityController extends AbstractController
throw $this->createNotFoundException('Accompanying Period not found'); throw $this->createNotFoundException('Accompanying Period not found');
} }
// TODO Add permission // TODO Add permission
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person); // $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
} else { } else {
throw $this->createNotFoundException('Person or Accompanying Period not found'); throw $this->createNotFoundException('Person or Accompanying Period not found');
} }

View File

@ -178,7 +178,6 @@ class ActivityContext implements
'placeholder' => $this->translator->trans('Any third party selected'), 'placeholder' => $this->translator->trans('Any third party selected'),
]); ]);
} }
} }
public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array

View File

@ -215,11 +215,13 @@ class AccompanyingPeriodContext implements
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter([$entity->getRequestorThirdParty()]), array_filter([$entity->getRequestorThirdParty()]),
array_filter(array_map( array_filter(
array_map(
fn (Resource $r): ?ThirdParty => $r->getThirdParty(), fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getResources()->filter( $entity->getResources()->filter(
static fn (Resource $r): bool => null !== $r->getThirdParty() static fn (Resource $r): bool => null !== $r->getThirdParty()
)->toArray()) )->toArray()
)
) )
); );

View File

@ -123,13 +123,14 @@ class AccompanyingPeriodWorkEvaluationContext implements
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray()), array_filter($entity->getAccompanyingPeriodWork()->getThirdParties()->toArray()),
array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()]), array_filter([$entity->getAccompanyingPeriodWork()->getHandlingThierParty()]),
array_filter(array_map( array_filter(
array_map(
fn (Resource $r): ?ThirdParty => $r->getThirdParty(), fn (Resource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter( $entity->getAccompanyingPeriodWork()->getAccompanyingPeriod()->getResources()->filter(
static fn (Resource $r): bool => null !== $r->getThirdParty() static fn (Resource $r): bool => null !== $r->getThirdParty()
)->toArray()) )->toArray()
)
) )
); );
$options = $template->getOptions(); $options = $template->getOptions();
@ -145,9 +146,6 @@ class AccompanyingPeriodWorkEvaluationContext implements
'placeholder' => $this->translator->trans('Any third party selected'), 'placeholder' => $this->translator->trans('Any third party selected'),
]); ]);
} }
} }
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array

View File

@ -177,18 +177,21 @@ final class PersonContext implements PersonContextInterface
]); ]);
$thirdParties = array_merge( $thirdParties = array_merge(
array_filter(array_map( array_filter(
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_map( array_filter(
array_map(
fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(), fn (PersonResource $r): ?ThirdParty => $r->getThirdParty(),
$entity->getResources()->filter( $entity->getResources()->filter(
static fn (PersonResource $r): bool => null !== $r->getThirdParty() static fn (PersonResource $r): bool => null !== $r->getThirdParty()
)->toArray()) )->toArray()
)
) )
); );

View File

@ -117,7 +117,7 @@ class ThirdPartyType extends AbstractType
'label' => 'thirdparty.Contact data are confidential', 'label' => 'thirdparty.Contact data are confidential',
]); ]);
// Institutional ThirdParty (parent) // Institutional ThirdParty (parent)
} else { } else {
$builder $builder
->add('nameCompany', TextType::class, [ ->add('nameCompany', TextType::class, [