Skip to content

[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

Closed
wants to merge 2 commits into from

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Feb 14, 2017

Refactoring of the serializer doc to list new normalizers introduced in 3.1 and enabled by default.

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

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

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

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

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

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

Choose a reason for hiding this comment

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

"When data objects always ..."

@HeahDude HeahDude added this to the 3.2 milestone Jul 29, 2017
@dunglas
Copy link
Member Author

dunglas commented Sep 5, 2017

Comments fixed.

@xabbuh xabbuh modified the milestones: 3.2, 3.3 Sep 15, 2017
* :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
Copy link
Member

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

Choose a reason for hiding this comment

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

[...] tagging them as [...]

@javiereguiluz
Copy link
Member

Thanks Kévin.

javiereguiluz added a commit that referenced this pull request Jan 2, 2018
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
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.

6 participants