-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] Add new default normalizers #7493
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
serializer.rst
Outdated
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) and the | ||
:ref:`ObjectNormalizer normalizer <component-serializer-normalizers>`. | ||
Once enabled, the ``serializer`` service will be available in the container. It comes with a set of useful :ref:`encoders <component-serializer-encoders>` | ||
and `normalizers <component-serializer-normalizers>`. |
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.
doesn't it miss :ref:
?
serializer.rst
Outdated
:ref:`serializer.normalizer <reference-dic-tags-serializer-normalizer>` and | ||
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also | ||
possible to set the priority of the tag in order to decide the matching order. | ||
|
||
Here is an example on how to load the | ||
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: | ||
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a faster alternative to the `ObjectNormalizer` |
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.
should be on two lines
serializer.rst
Outdated
(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and | ||
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) and the | ||
:ref:`ObjectNormalizer normalizer <component-serializer-normalizers>`. | ||
Once enabled, the ``serializer`` service will be available in the container. It comes with a set of useful :ref:`encoders <component-serializer-encoders>` |
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.
should be on two lines
serializer.rst
Outdated
(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and | ||
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) and the | ||
:ref:`ObjectNormalizer normalizer <component-serializer-normalizers>`. | ||
Once enabled, the ``serializer`` service will be available in the container. It comes with a set of useful :ref:`encoders <component-serializer-encoders>` |
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.
Please remember to keep lines shorter than 80 characters.
serializer.rst
Outdated
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer` to deal with object implementing the :class:`JsonSerializable` interface | ||
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix) | ||
|
||
You can also load custom normalizers and/or encoders by tagging them as |
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.
"Custom normalizers/encoders can also be loaded by tagging..."
serializer.rst
Outdated
:ref:`serializer.normalizer <reference-dic-tags-serializer-normalizer>` and | ||
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also | ||
possible to set the priority of the tag in order to decide the matching order. | ||
|
||
Here is an example on how to load the | ||
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: | ||
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a faster alternative to the `ObjectNormalizer` | ||
if your data objects always use getters and setters: |
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.
"When data objects always ..."
Comments fixed. |
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to | ||
transform :class:`SplFileInfo` objects in `Data URIs`_ | ||
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer` | ||
to deal with object implementing the :class:`JsonSerializable` 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.
[...] with objects implementing [...]
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to | ||
denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix) | ||
|
||
Custom normalizers and/or encoders can also be loaded by tagging as |
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.
[...] tagging them as [...]
Thanks Kévin. |
This PR was submitted for the 3.1 branch but it was squashed and merged into the 3.3 branch instead (closes #7493). Discussion ---------- [Serializer] Add new default normalizers Refactoring of the serializer doc to list new normalizers introduced in 3.1 and enabled by default. Commits ------- f1a5290 [Serializer] Add new default normalizers
Refactoring of the serializer doc to list new normalizers introduced in 3.1 and enabled by default.