[main] Add mainLocation field to User entity

This commit is contained in:
juminet
2022-01-16 22:36:55 +00:00
committed by Julien Fastré
parent dcbce270ad
commit 6843b4cb2a
5 changed files with 78 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
);
$locationContext = array_merge(
$context,
['docgen:expects' => Location::class, 'groups' => 'dogen:read']
['docgen:expects' => Location::class, 'groups' => 'docgen:read']
);
if (null === $user && 'docgen' === $format) {
@@ -67,6 +67,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
'main_center' => $this->normalizer->normalize(null, $format, $centerContext),
'main_scope' => $this->normalizer->normalize(null, $format, $scopeContext),
'current_location' => $this->normalizer->normalize(null, $format, $locationContext),
'main_location' => $this->normalizer->normalize(null, $format, $locationContext),
]);
}
@@ -84,6 +85,7 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
if ('docgen' === $format) {
$data['current_location'] = $this->normalizer->normalize($user->getCurrentLocation(), $format, $locationContext);
$data['main_location'] = $this->normalizer->normalize($user->getMainLocation(), $format, $locationContext);
}
return $data;