Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
[Serializer] Fix recursive custom normalizer#19532
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Yes, the solution proposed in this PR looks more elegant than the one you showed in the comment above. Thanks Mathias! |
autowiring only the object normalizer is a bad idea to me, because it assumes that no other normalizer than the ObjectNormalizer should be responsible for the delegated call. Note that depending on the context for the support here is not that bad: |
As mentioned in the following issue:symfony/symfony#53708, the example showing how to create a custom normalizer leads to an infinite recursion.
I could have been fixed like that:
But this will prevent the normalizer to be cacheable (because it depends on the context).
Instead, I dropped the use of
NormalizerAwareInterface
andNormalizerAwareTrait
and used an explicit constructor injection instead.WDYT?