Skip to content

Conversation

paxal
Copy link
Contributor

@paxal paxal commented Jun 29, 2018

Related to : https://github.com/api-platform/docs/blob/2.2/core/serialization.md#changing-the-serialization-context-on-a-per-item-basis

The class used in custom normalization example implements NormalizerInterface but the supportsNormalization() method is the one from the ContextAwareNormalizerInterface, and it must be this one to access $context variable and avoid call loops.

This doc is very valuable, thanks !

Related to : https://github.com/api-platform/docs/blob/2.2/core/serialization.md#changing-the-serialization-context-on-a-per-item-basis

The class used in custom normalization example implements `NormalizerInterface` but the `supportsNormalization()` method is the one from the `ContextAwareNormalizerInterface`, and it must be this one to access `$context` variable and avoid call loops.
@dunglas dunglas merged commit d759422 into api-platform:2.2 Jun 29, 2018
@dunglas
Copy link
Member

dunglas commented Jun 29, 2018

Good catch, thanks @paxal

@paxal paxal deleted the patch-1 branch June 29, 2018 13:54
@paxal
Copy link
Contributor Author

paxal commented Jun 29, 2018

Thanks for this awesome documentation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants