Skip to content

Add missing built-in normalizers #13326

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
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ As well as the following normalizers:
handle typical data objects
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for
objects implementing the :phpclass:`DateTimeInterface` interface
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateIntervalNormalizer` for :phpclass:`DateInterval` objects
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to
transform :phpclass:`SplFileInfo` objects in `Data URIs`_
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer`
to deal with objects implementing the :phpclass:`JsonSerializable` interface
* :class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer` to
denormalize arrays of objects using a format like `MyObject[]` (note the `[]` suffix)

.. _`Data URIs`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
Copy link
Contributor

Choose a reason for hiding this comment

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

The link is already present at the end of the file, you can delete the line


Custom normalizers and/or encoders can also be loaded by tagging them as
:ref:`serializer.normalizer <reference-dic-tags-serializer-normalizer>` and
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also
Expand Down
8 changes: 8 additions & 0 deletions serializer/normalizers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ Symfony includes the following normalizers but you can also

* :class:`Symfony\\Component\\Serializer\\Normalizer\\ObjectNormalizer` to
normalize PHP object using the :doc:`PropertyAccessor component </components/property_access>`;
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` for
objects implementing the :phpclass:`DateTimeInterface` interface
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateIntervalNormalizer` for :phpclass:`DateInterval` objects
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DataUriNormalizer` to
transform :phpclass:`SplFileInfo` objects in `Data URIs`_
* :class:`Symfony\\Component\\Serializer\\Normalizer\\CustomNormalizer` to
normalize PHP object using an object that implements
:class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizableInterface`;
* :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` to
normalize PHP object using the getter and setter methods of the object;
* :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer` to
normalize PHP object using `PHP reflection`_.
* :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer`
to deal with objects implementing the :phpclass:`JsonSerializable` interface

.. _`Data URIs`: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
.. _`PHP reflection`: https://php.net/manual/en/book.reflection.php