Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Symfony version(s) affected: 5.3
Description According to this post, the Context annotation allows to add context per attribute.
If you look closely into the code though, you'll discover that
Upon normalization, the callbacks are only retrieved from the context passed explicitly to normalize() method: https://github.com/symfony/serializer/blob/5d7f068253ac3e7c62964ebdda491b06d401059a/Normalizer/AbstractObjectNormalizer.php#L187
normalize()
Upon denormalization, either callbacks passed explicitly to denormalize() or passed as annotation, e.g.
denormalize()
/** * @Context({ * "denormalizationContext": { "callbacks": { "someValue": "doSomeStuffOnDenormalization" } } * }) */ private int $someValue;
are completely ignored. (?)
https://github.com/symfony/serializer/blob/5d7f068253ac3e7c62964ebdda491b06d401059a/Normalizer/AbstractObjectNormalizer.php#L401
How to reproduce Add Context annotation to an attribute, with callbacks for normalization / denormalization and see if they are actually called.
Possible Solution Add the missing functionality
The text was updated successfully, but these errors were encountered:
Any news on this issue? 😀
Sorry, something went wrong.
bug #45323 [Serializer] Fix ignored callbacks in denormalization (ben…
7fd9127
…jaminmal) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Serializer] Fix ignored callbacks in denormalization | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43563-2 | License | MIT | Doc PR | - Stop ignoring callbacks in denormalization. #freeTheCallbacks!!! Commits ------- abe18a0 [Serializer] Fix ignored callbacks in denormalization
No branches or pull requests
Symfony version(s) affected: 5.3
Description
According to this post, the Context annotation allows to add context per attribute.
If you look closely into the code though, you'll discover that
Upon normalization, the callbacks are only retrieved from the context passed explicitly to
normalize()
method:https://github.com/symfony/serializer/blob/5d7f068253ac3e7c62964ebdda491b06d401059a/Normalizer/AbstractObjectNormalizer.php#L187
Upon denormalization, either callbacks passed explicitly to
denormalize()
or passed as annotation, e.g.are completely ignored. (?)
https://github.com/symfony/serializer/blob/5d7f068253ac3e7c62964ebdda491b06d401059a/Normalizer/AbstractObjectNormalizer.php#L401
How to reproduce
Add Context annotation to an attribute, with callbacks for normalization / denormalization and see if they are actually called.
Possible Solution
Add the missing functionality
The text was updated successfully, but these errors were encountered: