From 3c8b2207c4b021566aed12b27a7a0d59d7004118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 27 May 2022 16:34:14 +0200 Subject: [PATCH] add civility in user docgen normalizer --- .../Serializer/Normalizer/UserNormalizer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index 365433ef3..eba8fc7bc 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Serializer\Normalizer; use Chill\MainBundle\Entity\Center; +use Chill\MainBundle\Entity\Civility; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; @@ -60,9 +61,14 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware $context, ['docgen:expects' => Location::class, 'groups' => 'docgen:read'] ); + $civilityContext = array_merge( + $context, + ['docgen:expects' => Civility::class, 'groups' => 'docgen:read'] + ); if (null === $user && 'docgen' === $format) { return array_merge(self::NULL_USER, [ + 'civility' => $this->normalizer->normalize(null, $format, $civilityContext), 'user_job' => $this->normalizer->normalize(null, $format, $userJobContext), 'main_center' => $this->normalizer->normalize(null, $format, $centerContext), 'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext), @@ -84,6 +90,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware ]; if ('docgen' === $format) { + $data['civility'] = $this->normalizer->normalize($user->getCivility(), $format, $civilityContext); $data['current_location'] = $this->normalizer->normalize($user->getCurrentLocation(), $format, $locationContext); $data['main_location'] = $this->normalizer->normalize($user->getMainLocation(), $format, $locationContext); }