-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
custom encoders interface signature #11439
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
Fixes the documentation about encoders that was wrong. Using `Symfony\Component\Serializer\Encoder\EncoderInterface` no `$context` parameter is passed to `supportsEncoding` method. YOu have to use the ContextAware version of it.
.. tip:: | ||
|
||
If you need access to ``$context`` in your ``supportsDecoding`` or ``supportsEncoding`` method, make sure | ||
to implements ``Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface`` or ``Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface`` interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to implements ``Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface`` or ``Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface`` interface | |
to implement ``Symfony\Component\Serializer\Encoder\ContextAwareDecoderInterface`` or ``Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface`` accordingly. |
Why the same interface twice?
and a . (Dot) is missing at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I found out by myself, Decoder
and Encoder
....
... and one more bug fixed, thank you Florian and congratulations on your first contribution to the Symfony-Docs 🎉 ❗️ |
This PR was merged into the 4.2 branch. Discussion ---------- custom encoders interface signature Fixes the documentation about encoders that was wrong. Using `Symfony\Component\Serializer\Encoder\EncoderInterface` no `$context` parameter is passed to `supportsEncoding` method. You have to use the ContextAware version of it. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 754a62b custom encoders interface signature
* 4.2: Tweaks. refs #11439 custom encoders interface signature
* 4.3: Tweaks. refs #11439 custom encoders interface signature
Fixes the documentation about encoders that was wrong.
Using
Symfony\Component\Serializer\Encoder\EncoderInterface
no$context
parameter is passed tosupportsEncoding
method. You have to use the ContextAware version of it.