From 6e21f2688f4b756c7183ec2ed1f96393e7b6ca55 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 26 May 2025 11:21:59 +0200 Subject: [PATCH] Add getSupportedTypes method for (de)normalizerInterface implementations --- .../Normalizer/StoredObjectDenormalizer.php | 4 +++- .../RequestPdfSignMessageSerializerTest.php | 14 +++++++++++++ .../Normalizer/AddressNormalizer.php | 18 +++++++++++++++- .../Normalizer/CenterNormalizer.php | 11 ++++++++++ .../Normalizer/CollectionNormalizer.php | 7 +++++++ .../CommentEmbeddableDocGenNormalizer.php | 5 +++++ .../Serializer/Normalizer/DateNormalizer.php | 21 +++++++++++++++++++ .../DiscriminatedObjectDenormalizer.php | 7 +++++++ .../DoctrineExistingEntityNormalizer.php | 7 +++++++ .../EntityWorkflowStepNormalizer.php | 5 +++++ .../Normalizer/GenderDocGenNormalizer.php | 7 +++++++ .../Normalizer/NotificationNormalizer.php | 5 +++++ .../Normalizer/PhonenumberNormalizer.php | 11 ++++++++++ .../Serializer/Normalizer/PointNormalizer.php | 7 +++++++ .../Normalizer/UserGroupDenormalizer.php | 11 ++++++++++ .../Serializer/Normalizer/UserNormalizer.php | 11 ++++++++++ .../Normalizer/UserNormalizerTest.php | 5 +++++ .../AccompanyingPeriodDocGenNormalizer.php | 5 +++++ ...ompanyingPeriodParticipationNormalizer.php | 7 +++++++ .../AccompanyingPeriodResourceNormalizer.php | 7 +++++++ .../AccompanyingPeriodWorkDenormalizer.php | 7 +++++++ ...anyingPeriodWorkEvaluationDenormalizer.php | 7 +++++++ ...PeriodWorkEvaluationDocumentNormalizer.php | 7 +++++++ ...mpanyingPeriodWorkEvaluationNormalizer.php | 5 +++++ .../AccompanyingPeriodWorkNormalizer.php | 8 +++++++ .../Normalizer/GenderDocGenNormalizer.php | 7 +++++++ .../Normalizer/MembersEditorNormalizer.php | 7 +++++++ .../Normalizer/PersonDocGenNormalizer.php | 5 +++++ .../Normalizer/PersonJsonNormalizer.php | 5 +++++ .../RelationshipDocGenNormalizer.php | 5 +++++ .../Normalizer/SocialActionNormalizer.php | 11 ++++++++++ .../Normalizer/SocialIssueNormalizer.php | 14 +++++++++++++ .../Normalizer/WorkflowNormalizer.php | 5 +++++ .../Normalizer/ThirdPartyNormalizer.php | 11 ++++++++++ 34 files changed, 277 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php index cb1d20deb..2fafd6eb6 100644 --- a/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php +++ b/src/Bundle/ChillDocStoreBundle/Serializer/Normalizer/StoredObjectDenormalizer.php @@ -86,6 +86,8 @@ class StoredObjectDenormalizer implements DenormalizerInterface public function getSupportedTypes(?string $format): array { - // TODO: Implement getSupportedTypes() method. + return [ + StoredObject::class => true, + ]; } } diff --git a/src/Bundle/ChillDocStoreBundle/Tests/Service/Signature/Driver/BaseSigner/RequestPdfSignMessageSerializerTest.php b/src/Bundle/ChillDocStoreBundle/Tests/Service/Signature/Driver/BaseSigner/RequestPdfSignMessageSerializerTest.php index d8f542f9e..d0ec747e1 100644 --- a/src/Bundle/ChillDocStoreBundle/Tests/Service/Signature/Driver/BaseSigner/RequestPdfSignMessageSerializerTest.php +++ b/src/Bundle/ChillDocStoreBundle/Tests/Service/Signature/Driver/BaseSigner/RequestPdfSignMessageSerializerTest.php @@ -117,6 +117,13 @@ class RequestPdfSignMessageSerializerTest extends TestCase { return $data instanceof PDFSignatureZone; } + + public function getSupportedTypes(?string $format): array + { + return [ + PDFSignatureZone::class => true, + ]; + } }; $denormalizer = new class () implements DenormalizerInterface { public function denormalize($data, string $type, ?string $format = null, array $context = []): mixed @@ -128,6 +135,13 @@ class RequestPdfSignMessageSerializerTest extends TestCase { return PDFSignatureZone::class === $type; } + + public function getSupportedTypes(?string $format): array + { + return [ + PDFSignatureZone::class => true, + ]; + } }; $serializer = new Serializer([$normalizer, $denormalizer]); diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index f4255f5f0..c8ff9c335 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -16,7 +16,6 @@ use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Templating\Entity\AddressRender; use Symfony\Component\Serializer\Exception\UnexpectedValueException; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; -use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; @@ -137,4 +136,21 @@ class AddressNormalizer implements \Symfony\Component\Serializer\Normalizer\Norm return false; } + + public function getSupportedTypes(?string $format): array + { + if ('json' === $format) { + return [ + Address::class => true, + ]; + } + + if ('docgen' === $format) { + return [ + Address::class => false, + ]; + } + + return []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php index 046f9a97e..04a9ea786 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CenterNormalizer.php @@ -69,4 +69,15 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface { return $data instanceof Center && 'json' === $format; } + + public function getSupportedTypes(?string $format): array + { + if ('json' !== $format && null !== $format) { + return []; + } + + return [ + Center::class => true, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php index bf84abf69..f1fb9ea0f 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php @@ -45,4 +45,11 @@ class CollectionNormalizer implements NormalizerAwareInterface, NormalizerInterf { return $data instanceof Collection; } + + public function getSupportedTypes(?string $format): array + { + return [ + Collection::class => true, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index b3b7f5d38..119e60dad 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -82,4 +82,9 @@ class CommentEmbeddableDocGenNormalizer implements \Symfony\Component\Serializer return false; } + + public function getSupportedTypes(?string $format): array + { + return 'docgen' === $format ? [CommentEmbeddable::class => true] : []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php index d826d47c6..739d299c0 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DateNormalizer.php @@ -121,4 +121,25 @@ class DateNormalizer implements \Symfony\Component\Serializer\Normalizer\Normali return false; } + + public function getSupportedTypes(?string $format): array + { + if ('json' === $format) { + return [ + \DateTimeInterface::class => true, + \DateTime::class => true, + \DateTimeImmutable::class => true, + ]; + } + + if ('docgen' === $format) { + return [ + \DateTimeInterface::class => true, + \DateTime::class => true, + \DateTimeImmutable::class => true, + ]; + } + + return []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php index 3f413e442..6bd69724a 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php @@ -69,4 +69,11 @@ class DiscriminatedObjectDenormalizer implements \Symfony\Component\Serializer\N return false; } + + public function getSupportedTypes(?string $format): array + { + return [ + self::TYPE => true, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php index edfef0ee6..b457b3949 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DoctrineExistingEntityNormalizer.php @@ -65,4 +65,11 @@ class DoctrineExistingEntityNormalizer implements DenormalizerInterface // we do not have any class discriminator. Check that the id is the only one key return 1 === \count($data); } + + public function getSupportedTypes(?string $format): array + { + return [ + 'object' => false, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php index 4c7319c6a..70ebf9be1 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/EntityWorkflowStepNormalizer.php @@ -79,4 +79,9 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz { return $data instanceof EntityWorkflowStep && 'json' === $format; } + + public function getSupportedTypes(?string $format): array + { + return 'json' === $format ? [EntityWorkflowStep::class => true] : []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/GenderDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/GenderDocGenNormalizer.php index 62dbc73f8..c604fd6db 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/GenderDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/GenderDocGenNormalizer.php @@ -37,4 +37,11 @@ class GenderDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer 'type' => 'chill_main_gender', ]; } + + public function getSupportedTypes(?string $format): array + { + return [ + Gender::class => true, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index b726504a2..9b11e2ad8 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -55,4 +55,9 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte { return $data instanceof Notification && 'json' === $format; } + + public function getSupportedTypes(?string $format): array + { + return 'json' === $format ? [Notification::class => true] : []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index fb855d431..b0a0c5ee4 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -78,4 +78,15 @@ class PhonenumberNormalizer implements \Symfony\Component\Serializer\Normalizer\ return false; } + + public function getSupportedTypes(?string $format): array + { + if ('json' === $format || 'docgen' === $format) { + return [ + PhoneNumber::class => true, + ]; + } + + return []; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php index 3b1ed326c..81dc07026 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PointNormalizer.php @@ -34,4 +34,11 @@ class PointNormalizer implements DenormalizerInterface { return Point::class === $type; } + + public function getSupportedTypes(?string $format): array + { + return [ + Point::class => true, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserGroupDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserGroupDenormalizer.php index 81b85ce7b..0e395900e 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserGroupDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserGroupDenormalizer.php @@ -34,4 +34,15 @@ class UserGroupDenormalizer implements DenormalizerInterface && 2 === count(array_keys($data)) ; } + + public function getSupportedTypes(?string $format): array + { + if ('json' !== $format) { + return []; + } + + return [ + UserGroup::class => false, + ]; + } } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php index e089c7b7f..8dbbc6042 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/UserNormalizer.php @@ -122,4 +122,15 @@ class UserNormalizer implements \Symfony\Component\Serializer\Normalizer\Normali return false; } + + public function getSupportedTypes(?string $format): array + { + if ('json' === $format || 'docgen' === $format) { + return [ + User::class => true, + ]; + } + + return []; + } } diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php index cdc01de34..d3870bcd2 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php @@ -136,6 +136,11 @@ final class UserNormalizerTest extends TestCase { return true; } + + public function getSupportedTypes(?string $format): array + { + return ['*' => true]; + } }); $this->assertEquals($expected, $normalizer->normalize($user, $format, $context)); diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php index f9c0eac5e..dd4d1f741 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodDocGenNormalizer.php @@ -183,4 +183,9 @@ class AccompanyingPeriodDocGenNormalizer implements \Symfony\Component\Serialize return false; } + + public function getSupportedTypes(?string $format): array + { + return 'docgen' === $format ? [AccompanyingPeriod::class => true] : []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php index b6f92bdb7..af9f7b276 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodParticipationNormalizer.php @@ -45,4 +45,11 @@ class AccompanyingPeriodParticipationNormalizer implements NormalizerAwareInterf return $data instanceof AccompanyingPeriodParticipation; } + + public function getSupportedTypes(?string $format): array + { + return [ + AccompanyingPeriodParticipation::class => true, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php index 58e2de1ea..7e2ef579c 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodResourceNormalizer.php @@ -95,4 +95,11 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface { return Resource::class === $type; } + + public function getSupportedTypes(?string $format): array + { + return [ + Resource::class => true, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php index 81b4489a6..1da8946e5 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkDenormalizer.php @@ -112,4 +112,11 @@ class AccompanyingPeriodWorkDenormalizer implements \Symfony\Component\Serialize $work->addAccompanyingPeriodWorkEvaluation($evaluation); } } + + public function getSupportedTypes(?string $format): array + { + return [ + AccompanyingPeriodWork::class => true, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizer.php index 8cc559c49..9ff6b21c3 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDenormalizer.php @@ -103,4 +103,11 @@ class AccompanyingPeriodWorkEvaluationDenormalizer implements \Symfony\Component $evaluation->addDocument($document); } } + + public function getSupportedTypes(?string $format): array + { + return [ + AccompanyingPeriodWorkEvaluation::class => true, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php index 17d33fadb..6c27635a4 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationDocumentNormalizer.php @@ -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, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 4a3a6af48..add0ed656 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -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] : []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php index 41586aa0f..1a594aaae 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkNormalizer.php @@ -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 => [], + }; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php index 74527fa62..3ec66a955 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/GenderDocGenNormalizer.php @@ -36,4 +36,11 @@ class GenderDocGenNormalizer implements \Symfony\Component\Serializer\Normalizer 'genderTranslation' => $gender->getGenderTranslation(), ]; } + + public function getSupportedTypes(?string $format): array + { + return [ + Gender::class => true, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php index 850730565..563abc340 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php @@ -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, + ]; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php index 9fb3b35e2..31367b69f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonDocGenNormalizer.php @@ -247,4 +247,9 @@ class PersonDocGenNormalizer implements return $data; } + + public function getSupportedTypes(?string $format): array + { + return 'docgen' === $format ? [Person::class => true] : []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 8a2a5c46b..199c9df9f 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -241,4 +241,9 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar ) ->toArray(); } + + public function getSupportedTypes(?string $format): array + { + return 'json' === $format ? [Person::class => true] : []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php index 3f1859856..1e6b4b4e5 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/RelationshipDocGenNormalizer.php @@ -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] : []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php index 11cd05760..afe0c01fa 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialActionNormalizer.php @@ -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 []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php index 650cb3ea4..b60b94e95 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/SocialIssueNormalizer.php @@ -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 []; + } } diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php index b2f43c83a..8539f00e5 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/WorkflowNormalizer.php @@ -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] : []; + } } diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php index 84e8e1721..f10eb85f6 100644 --- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php +++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php @@ -68,4 +68,15 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf { return $data instanceof ThirdParty && 'json' === $format; } + + public function getSupportedTypes(?string $format): array + { + if ('json' !== $format) { + return []; + } + + return [ + ThirdParty::class => true, + ]; + } }