mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 04:19:43 +00:00
Resolve "Absence user: add end date"
This commit is contained in:
@@ -39,6 +39,8 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
||||
'label' => '',
|
||||
'email' => '',
|
||||
'isAbsent' => false,
|
||||
'absenceStart' => null,
|
||||
'absenceEnd' => null,
|
||||
];
|
||||
|
||||
public function __construct(private readonly UserRender $userRender, private readonly ClockInterface $clock) {}
|
||||
@@ -77,6 +79,11 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
||||
['docgen:expects' => PhoneNumber::class, 'groups' => 'docgen:read']
|
||||
);
|
||||
|
||||
$absenceDatesContext = array_merge(
|
||||
$context,
|
||||
['docgen:expects' => \DateTimeImmutable::class, 'groups' => 'docgen:read']
|
||||
);
|
||||
|
||||
if (null === $object && 'docgen' === $format) {
|
||||
return [...self::NULL_USER, 'phonenumber' => $this->normalizer->normalize(null, $format, $phonenumberContext), '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), 'current_location' => $this->normalizer->normalize(null, $format, $locationContext), 'main_location' => $this->normalizer->normalize(null, $format, $locationContext)];
|
||||
}
|
||||
@@ -99,6 +106,8 @@ class UserNormalizer implements ContextAwareNormalizerInterface, NormalizerAware
|
||||
'main_center' => $this->normalizer->normalize($object->getMainCenter(), $format, $centerContext),
|
||||
'main_scope' => $this->normalizer->normalize($object->getMainScope($at), $format, $scopeContext),
|
||||
'isAbsent' => $object->isAbsent(),
|
||||
'absenceStart' => $this->normalizer->normalize($object->getAbsenceStart(), $format, $absenceDatesContext),
|
||||
'absenceEnd' => $this->normalizer->normalize($object->getAbsenceEnd(), $format, $absenceDatesContext),
|
||||
];
|
||||
|
||||
if ('docgen' === $format) {
|
||||
|
Reference in New Issue
Block a user