Skip to content

Commit

Permalink
Use the built-in serializer instead of promoting JMS
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jun 23, 2015
1 parent 6d17756 commit beac11e
Showing 1 changed file with 6 additions and 10 deletions.
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 </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 @@ -100,5 +98,3 @@ Here is an example on how to load the
));
$definition->addTag('serializer.normalizer');
$container->setDefinition('get_set_method_normalizer', $definition);
.. _JMSSerializerBundle: http://jmsyst.com/bundles/JMSSerializerBundle

0 comments on commit beac11e

Please sign in to comment.