Skip to content
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

Promote builtin serializer instead of JMS #5074

Closed
Closed
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
16 changes: 6 additions & 10 deletions cookbook/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ How to Use the Serializer

Serializing and deserializing to and from objects and different formats (e.g.
JSON or XML) is a very complex topic. Symfony comes with a
:doc:`Serializer Component</components/serializer>`, which gives you some
:doc:`Serializer Component </components/serializer>`, which gives you some
tools that you can leverage for your solution.

In fact, before you start, get familiar with the serializer, normalizers
and encoders by reading the :doc:`Serializer Component</components/serializer>`.
You should also check out the `JMSSerializerBundle`_, which expands on the
functionality offered by Symfony's core serializer.
and encoders by reading the :doc:`Serializer Component documentation </components/serializer>`.

Activating the Serializer
-------------------------
Expand Down Expand Up @@ -56,15 +54,15 @@ Adding Normalizers and Encoders
-------------------------------

Once enabled, the ``serializer`` service will be available in the container
and will be loaded with two :ref:`encoders<component-serializer-encoders>`
and will be loaded with two :ref:`encoders <component-serializer-encoders>`
(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and
:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`)
but no :ref:`normalizers<component-serializer-normalizers>`, meaning you'll
but no :ref:`normalizers <component-serializer-normalizers>`, meaning you'll
need to load your own.

You can load normalizers and/or encoders by tagging them as
:ref:`serializer.normalizer<reference-dic-tags-serializer-normalizer>` and
:ref:`serializer.encoder<reference-dic-tags-serializer-encoder>`. It's also
: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
Expand Down Expand Up @@ -107,5 +105,3 @@ Here is an example on how to load the
is broken by design. As soon as you have a circular object graph, an
infinite loop is created when calling the getters. You're encouraged
to add your own normalizers that fit your use-case.

.. _JMSSerializerBundle: http://jmsyst.com/bundles/JMSSerializerBundle