Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Wrong parameter's name for Serializer Yaml configuration #21010

Closed
Labels
SerializerhasPRA Pull Request has already been submitted for this issue.
@b-viguier

Description

@b-viguier

Serializer's documentation explains that we can specify a context specific to normalization or denormalization usingnormalizationContext anddenormalizationContext keys in Yaml configuration:

https://github.com/symfony/symfony-docs/blob/6.4/serializer.rst?plain=1#L523-L524

# config/serializer/person.yamlApp\Model\Person:attributes:createdAt:contexts:                -normalizationContext:{ datetime_format: 'Y-m-d' }denormalizationContext:{ datetime_format: !php/const \DateTime::RFC3339 }

In the other hand, theYamlFileLoader is looking fornormalization_context anddenormalization_context keys:

https://github.com/symfony/symfony/blob/b43330568c434747ec5efe2aed7c14c7995e551a/src/Symfony/Component/Serializer/Mapping/Loader/YamlFileLoader.php#L114-L120

if ($context =$line['normalization_context'] ??false) {$attributeMetadata->setNormalizationContextForGroups($context,$groups);}if ($context =$line['denormalization_context'] ??false) {$attributeMetadata->setDenormalizationContextForGroups($context,$groups);}

Links above are for6.4 but it seems to be there from the beginning, nothing changed in the code. Confusion may be due to the name of the corresponding attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SerializerhasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp