Skip to content

Update serialization example with getSupportedTypes()Β #2230

@Cocray

Description

@Cocray

Hello,

It'd be great to update the normalization example with the getSupportedTypes() method, as it is deprecated since Symfony 6.3 to not implement it.

I also think useful to explain how to do this part:

        // Make sure we're not called twice
        if (isset($context[self::ALREADY_CALLED])) {
            return false;
        }

when we have this:


    public function getSupportedTypes(?string $format): array
    {
        return [
            Book::class => true,
        ];
    }

Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions