From 4b988ea60c4f457c10dc9091a698274acfe9dc9f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 11 Mar 2015 15:34:55 +0100 Subject: [PATCH] Use the built-in serializer instead of promoting JMS --- cookbook/serializer.rst | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cookbook/serializer.rst b/cookbook/serializer.rst index 762a0f86d19..c41cfe616f1 100644 --- a/cookbook/serializer.rst +++ b/cookbook/serializer.rst @@ -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`, which gives you some +:doc:`Serializer Component `, 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`. -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 `. Activating the Serializer ------------------------- @@ -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` +and will be loaded with two :ref:`encoders ` (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) -but no :ref:`normalizers`, meaning you'll +but no :ref:`normalizers `, meaning you'll need to load your own. You can load normalizers and/or encoders by tagging them as -:ref:`serializer.normalizer` and -:ref:`serializer.encoder`. It's also +:ref:`serializer.normalizer ` and +:ref:`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 @@ -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