mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
add civility in user docgen normalizer
This commit is contained in:
parent
7278a5f3fa
commit
3c8b2207c4
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Chill\MainBundle\Entity\Civility;
|
||||||
use Chill\MainBundle\Entity\Location;
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
@ -60,9 +61,14 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
$context,
|
$context,
|
||||||
['docgen:expects' => Location::class, 'groups' => 'docgen:read']
|
['docgen:expects' => Location::class, 'groups' => 'docgen:read']
|
||||||
);
|
);
|
||||||
|
$civilityContext = array_merge(
|
||||||
|
$context,
|
||||||
|
['docgen:expects' => Civility::class, 'groups' => 'docgen:read']
|
||||||
|
);
|
||||||
|
|
||||||
if (null === $user && 'docgen' === $format) {
|
if (null === $user && 'docgen' === $format) {
|
||||||
return array_merge(self::NULL_USER, [
|
return array_merge(self::NULL_USER, [
|
||||||
|
'civility' => $this->normalizer->normalize(null, $format, $civilityContext),
|
||||||
'user_job' => $this->normalizer->normalize(null, $format, $userJobContext),
|
'user_job' => $this->normalizer->normalize(null, $format, $userJobContext),
|
||||||
'main_center' => $this->normalizer->normalize(null, $format, $centerContext),
|
'main_center' => $this->normalizer->normalize(null, $format, $centerContext),
|
||||||
'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext),
|
'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext),
|
||||||
@ -84,6 +90,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ('docgen' === $format) {
|
if ('docgen' === $format) {
|
||||||
|
$data['civility'] = $this->normalizer->normalize($user->getCivility(), $format, $civilityContext);
|
||||||
$data['current_location'] = $this->normalizer->normalize($user->getCurrentLocation(), $format, $locationContext);
|
$data['current_location'] = $this->normalizer->normalize($user->getCurrentLocation(), $format, $locationContext);
|
||||||
$data['main_location'] = $this->normalizer->normalize($user->getMainLocation(), $format, $locationContext);
|
$data['main_location'] = $this->normalizer->normalize($user->getMainLocation(), $format, $locationContext);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user