Skip to content

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

Merged
merged 1 commit into from
May 24, 2019
Merged

Conversation

PandaaAgency
Copy link
Contributor

@PandaaAgency PandaaAgency commented Apr 15, 2019

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.

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
Copy link
Contributor

@OskarStark OskarStark Apr 15, 2019

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Contributor

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....

@OskarStark OskarStark added this to the 4.2 milestone May 24, 2019
@OskarStark
Copy link
Contributor

OskarStark commented May 24, 2019

... and one more bug fixed, thank you Florian and congratulations on your first contribution to the Symfony-Docs 🎉 ❗️

@OskarStark OskarStark merged commit 754a62b into symfony:4.2 May 24, 2019
OskarStark added a commit that referenced this pull request May 24, 2019
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
OskarStark added a commit that referenced this pull request May 24, 2019
OskarStark added a commit that referenced this pull request May 24, 2019
* 4.2:
  Tweaks. refs #11439
  custom encoders interface signature
OskarStark added a commit that referenced this pull request May 24, 2019
* 4.3:
  Tweaks. refs #11439
  custom encoders interface signature
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.

4 participants