Undo inadequate fix of normalizers

This commit is contained in:
2025-09-11 09:40:37 +02:00
parent 4bd9e2ba7d
commit cc8151546a
3 changed files with 0 additions and 52 deletions

View File

@@ -42,25 +42,6 @@ class AccompanyingPeriodWorkNormalizer implements \Symfony\Component\Serializer\
if ('docgen' === $format && !($object instanceof AccompanyingPeriodWork || null === $object)) {
throw new UnexpectedValueException(sprintf('Object must be an instanceof AccompanyingPeriodWork or null when format is docgen, %s given', get_debug_type($object)));
}
// Prevent circular references
if ($object instanceof AccompanyingPeriodWork && 'json' === $format) {
$objectHash = spl_object_hash($object);
$visitedKey = 'accompanying_period_work_visited';
if (isset($context[$visitedKey][$objectHash])) {
return [
'id' => $object->getId(),
'type' => 'accompanying_period_work',
'startDate' => $object->getStartDate()?->format('c'),
'endDate' => $object->getEndDate()?->format('c'),
'note' => $object->getNote(),
];
}
$context[$visitedKey][$objectHash] = true;
}
$cleanContext = array_filter($context, fn (string|int $key) => !in_array($key, ['docgen:expects', self::IGNORE_WORK], true), ARRAY_FILTER_USE_KEY);
if (null === $object && 'docgen' === $format) {
@@ -124,7 +105,6 @@ class AccompanyingPeriodWorkNormalizer implements \Symfony\Component\Serializer\
// then, we add normalization for things which are not into the entity
$initial['workflows_availables'] = $this->metadataExtractor->availableWorkflowFor(
AccompanyingPeriodWork::class,
$object->getId() ?? 0
);
$initial['workflows_availables_evaluation'] = $this->metadataExtractor->availableWorkflowFor(
@@ -137,7 +117,6 @@ class AccompanyingPeriodWorkNormalizer implements \Symfony\Component\Serializer\
$workflows = $this->entityWorkflowRepository->findBy([
'relatedEntityClass' => AccompanyingPeriodWork::class,
'relatedEntityId' => $object->getId() ?? 0,
]);
$initial['workflows'] = $this->normalizer->normalize($workflows, 'json', $context);