From 78cf817921d03da91dd66dd3ae1b6ed7761c871c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 4 Jan 2022 23:50:22 +0100 Subject: [PATCH] docgen: add location to accompanying period --- .../Normalizer/AccompanyingPeriodDocGenNormalizer.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index 4343561fc..64f77f569 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Serializer\Normalizer; use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper; +use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher; @@ -65,6 +66,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'requestorPerson' => Person::class, 'requestorThirdParty' => ThirdParty::class, 'resources' => Collection::class, + 'location' => Address::class, + 'locationPerson' => Person::class, ]; private ClosingMotiveRender $closingMotiveRender; @@ -104,6 +107,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf $scopes = [$scopes]; } + $addressContext = array_merge($context, ['docgen:expects' => Address::class, 'groups' => 'docgen:read']); $dateContext = array_merge($context, ['docgen:expects' => DateTime::class, 'groups' => 'docgen:read']); $userContext = array_merge($context, ['docgen:expects' => User::class, 'groups' => 'docgen:read']); $participationContext = array_merge($context, ['docgen:expects' => AccompanyingPeriodParticipation::class, 'groups' => 'docgen:read']); @@ -147,6 +151,10 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf }, $scopes)), 'hasRequestor' => $period->getRequestor() !== null, 'requestorKind' => $period->getRequestorKind(), + 'hasLocation' => $period->getLocation() !== null, + 'hasLocationPerson' => $period->getPersonLocation() !== null, + 'locationPerson' => $this->normalizer->normalize($period->getPersonLocation(), $format, array_merge($context, ['docgen:expects' => Person::class])), + 'location' => $this->normalizer->normalize($period->getLocation(), $format, $addressContext), ]; } @@ -162,6 +170,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf 'hasRequestorThirdParty' => false, 'isClosed' => false, 'confidential' => false, + 'hasLocation' => false, + 'hasLocationPerson' => false, ] ); }