-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] Document Normalizers #10515
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
0ec283d
to
e13e9e1
Compare
.. index:: | ||
single: Serializer; Custom normalizers | ||
|
||
How to Create your Custom Normalizer |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
I copied the schema of https://symfony.com/doc/current/serializer/custom_encoders.html ; So are you sure I should be not consistant with existing documentation?
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.
Fair enough, lets keep it then 👍
serializer/custom_normalizer.rst
Outdated
private $router; | ||
private $normaliser; | ||
|
||
public function __construct(UrlGeneratorInterface $router, ObjectNormalizer $normaliser) |
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.
s/$normaliser/$normalizer/
serializer/custom_normalizer.rst
Outdated
|
||
namespace AppBundle\Serializer; | ||
|
||
use App\Entity\Topic; |
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.
you use App
here, but 2 lines above you are in AppBundle
namespace, maybe a mistake?
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.
yes, good catch :) thanks
e13e9e1
to
0837b4f
Compare
0837b4f
to
aa4a747
Compare
} | ||
} | ||
|
||
Registering it in your app |
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.
A question for when we merge this into upper branches. Does Symfony autoconfiguration support Normalizers? Thanks!
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.
Yes it does ❤️
I already planned to open a new PR to remove theses for new Symfony versions
Thanks Grégoire! This has been merged now. |
The change it's now merged in all branches. Next steps would be:
Thanks! |
refs #10505