Skip to content

Commit

Permalink
[FrameworkBundle] Name converter of Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and wouterj committed Feb 6, 2016
1 parent d7c9085 commit 7a4d9fc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
2 changes: 2 additions & 0 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ method on the normalizer definition::
$serializer = new Serializer(array($normalizer), array($encoder));
$serializer->serialize($person, 'json'); // Output: {"name":"foo","sportsman":false}

.. _component-serializer-converting-property-names-when-serializing-and-deserializing:

Converting Property Names when Serializing and Deserializing
------------------------------------------------------------

Expand Down
4 changes: 4 additions & 0 deletions cookbook/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Here is an example on how to load the
$definition->addTag('serializer.normalizer');
$container->setDefinition('get_set_method_normalizer', $definition);
.. _cookbook-serializer-using-serialization-groups-annotations:

Using Serialization Groups Annotations
--------------------------------------

Expand Down Expand Up @@ -170,6 +172,8 @@ to your class and choose which groups to use when serializing::
'json', array('groups' => array('group1')
);

.. _cookbook-serializer-enabling-metadata-cache:

Enabling the Metadata Cache
---------------------------

Expand Down
49 changes: 47 additions & 2 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Configuration
* `validation`_
* :ref:`enabled <reference-validation-enabled>`
* :ref:`cache <reference-validation-cache>`
* `enable_annotations`_
* :ref:`enable_annotations <reference-validation-enable_annotations>`
* `translation_domain`_
* `strict_email`_
* `api`_
Expand All @@ -102,6 +102,9 @@ Configuration
* `debug`_
* `serializer`_
* :ref:`enabled <reference-serializer-enabled>`
* :ref:`cache <reference-serializer-cache>`
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
* `name_converter`_

secret
~~~~~~
Expand Down Expand Up @@ -1372,6 +1375,8 @@ cache
The service that is used to persist class metadata in a cache. The service
has to implement the :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`.

.. _reference-validation-enable_annotations:

enable_annotations
..................

Expand Down Expand Up @@ -1478,7 +1483,47 @@ enabled

Whether to enable the ``serializer`` service or not in the service container.

For more details, see :doc:`/cookbook/serializer`.
.. _reference-serializer-cache:

cache
.....

**type**: ``string``

The service that is used to persist class metadata in a cache. The service
has to implement the :class:`Doctrine\\Common\\Cache\\Cache` interface.

.. seealso::

For more information, see :ref:`cookbook-serializer-enabling-metadata-cache`.

.. _reference-serializer-enable_annotations:

enable_annotations
..................

**type**: ``boolean`` **default**: ``false``

If this option is enabled, serialization groups can be defined using annotations.

.. seealso::

For more information, see :ref:`cookbook-serializer-using-serialization-groups-annotations`.

name_converter
..............

**type**: ``string``

The name converter to use.
The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter`
name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case``
value.

.. seealso::

For more information, see
:ref:`component-serializer-converting-property-names-when-serializing-and-deserializing`.

Full Default Configuration
--------------------------
Expand Down

0 comments on commit 7a4d9fc

Please sign in to comment.