Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix deserializing object collection properties #51369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

X-Coder264
Copy link
Contributor

@X-Coder264 X-Coder264 commented Aug 12, 2023

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #51261
License MIT
Doc PR -

On Symfony <= 6.2 serializer versions the supportsDenormalization was always called in \Symfony\Component\Serializer\Serializer::getDenormalizer.

When the getSupportedTypes logic was introduced for Symfony 6.3 serializer some if statement conditions were introduced and if they are true the supportsDenormalization logic is not called at all anymore. Those conditions currently prevent a legit use-case that worked prior to 6.3 from calling the supportsDenormalization method - the case being when the denormalizer is supposed to denormalize a collection/array of objects. This use-case still works even on the 6.3 serializer as long as the denormalizer does not implement the new getSupportedTypes method, but that is triggering a deprecation.

This PR aims to fix that so that denormalizing an array of objects still works even when using the new getSupportedTypes method in a denormalizer.

cc @tucksaun @nicolas-grekas

Copy link
Contributor

@andersmateusz andersmateusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this on my local environment. Seems legit.

@X-Coder264 X-Coder264 force-pushed the fix-deserializing-object-collection-properties branch from 7ad9e6e to 32dc134 Compare August 22, 2023 18:29
@nicolas-grekas
Copy link
Member

Thank you @X-Coder264.

@nicolas-grekas nicolas-grekas merged commit 469f1cc into symfony:6.3 Aug 23, 2023
@X-Coder264 X-Coder264 deleted the fix-deserializing-object-collection-properties branch August 23, 2023 10:15
@fabpot fabpot mentioned this pull request Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants