Add getSupportedTypes method for (de)normalizerInterface implementations

This commit is contained in:
2025-05-26 11:21:59 +02:00
parent 17db59d221
commit 6e21f2688f
34 changed files with 277 additions and 2 deletions

View File

@@ -183,4 +183,9 @@ class AccompanyingPeriodDocGenNormalizer implements \Symfony\Component\Serialize
return false;
}
public function getSupportedTypes(?string $format): array
{
return 'docgen' === $format ? [AccompanyingPeriod::class => true] : [];
}
}

View File

@@ -45,4 +45,11 @@ class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterf
return $data instanceof AccompanyingPeriodParticipation;
}
public function getSupportedTypes(?string $format): array
{
return [
AccompanyingPeriodParticipation::class => true,
];
}
}

View File

@@ -95,4 +95,11 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
{
return Resource::class === $type;
}
public function getSupportedTypes(?string $format): array
{
return [
Resource::class => true,
];
}
}

View File

@@ -112,4 +112,11 @@ class AccompanyingPeriodWorkDenormalizer implements \Symfony\Component\Serialize
$work->addAccompanyingPeriodWorkEvaluation($evaluation);
}
}
public function getSupportedTypes(?string $format): array
{
return [
AccompanyingPeriodWork::class => true,
];
}
}

View File

@@ -103,4 +103,11 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements \Symfony\Component
$evaluation->addDocument($document);
}
}
public function getSupportedTypes(?string $format): array
{
return [
AccompanyingPeriodWorkEvaluation::class => true,
];
}
}

View File

@@ -56,4 +56,11 @@ class AccompanyingPeriodWorkEvaluationDocumentNormalizer implements \Symfony\Com
|| spl_object_hash($data) !== $context[self::SKIP]
);
}
public function getSupportedTypes(?string $format): array
{
return [
AccompanyingPeriodWorkEvaluationDocument::class => true,
];
}
}

View File

@@ -70,4 +70,9 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements \Symfony\Component\S
&& $data instanceof AccompanyingPeriodWorkEvaluation
&& !\array_key_exists(self::IGNORE_EVALUATION, $context);
}
public function getSupportedTypes(?string $format): array
{
return 'json' === $format ? [AccompanyingPeriodWorkEvaluation::class => true] : [];
}
}

View File

@@ -137,4 +137,12 @@ class AccompanyingPeriodWorkNormalizer implements \Symfony\Component\Serializer\
default => false,
};
}
public function getSupportedTypes(?string $format): array
{
return match ($format) {
'json', 'docgen' => [AccompanyingPeriodWork::class => true],
default => [],
};
}
}

View File

@@ -36,4 +36,11 @@ class GenderDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer
'genderTranslation' => $gender->getGenderTranslation(),
];
}
public function getSupportedTypes(?string $format): array
{
return [
Gender::class => true,
];
}
}

View File

@@ -181,4 +181,11 @@ class MembersEditorNormalizer implements DenormalizerAwareInterface, Denormalize
throw new Exception\UnexpectedValueException("The schema does not have any key 'destination'");
}
}
public function getSupportedTypes(?string $format): array
{
return [
MembersEditor::class => true,
];
}
}

View File

@@ -247,4 +247,9 @@ class PersonDocGenNormalizer implements
return $data;
}
public function getSupportedTypes(?string $format): array
{
return 'docgen' === $format ? [Person::class => true] : [];
}
}

View File

@@ -241,4 +241,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
)
->toArray();
}
public function getSupportedTypes(?string $format): array
{
return 'json' === $format ? [Person::class => true] : [];
}
}

View File

@@ -83,4 +83,9 @@ class RelationshipDocGenNormalizer implements \Symfony\Component\Serializer\Norm
return $data instanceof Relationship || (null === $data
&& Relationship::class === ($context['docgen:expects'] ?? null));
}
public function getSupportedTypes(?string $format): array
{
return 'docgen' === $format ? [Relationship::class => true] : [];
}
}

View File

@@ -75,4 +75,15 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte
return false;
}
public function getSupportedTypes(?string $format): array
{
if ('json' === $format || 'docgen' === $format) {
return [
SocialAction::class => true,
];
}
return [];
}
}

View File

@@ -48,6 +48,9 @@ class SocialIssueNormalizer implements \Symfony\Component\Serializer\Normalizer\
'title' => $socialIssue->getTitle(),
'text' => $this->render->renderString($socialIssue, []),
];
default:
return [];
}
}
@@ -69,4 +72,15 @@ class SocialIssueNormalizer implements \Symfony\Component\Serializer\Normalizer\
return false;
}
public function getSupportedTypes(?string $format): array
{
if ('json' === $format || 'docgen' === $format) {
return [
SocialIssue::class => true,
];
}
return [];
}
}

View File

@@ -58,4 +58,9 @@ class WorkflowNormalizer implements \Symfony\Component\Serializer\Normalizer\Nor
&& $data instanceof EntityWorkflow
&& !\array_key_exists(self::IGNORE_ENTITY_WORKFLOW, $context);
}
public function getSupportedTypes(?string $format): array
{
return 'json' === $format ? [EntityWorkflow::class => true] : [];
}
}