Skip to content

Commit 7a4d9fc

Browse files
dunglaswouterj
authored andcommitted
[FrameworkBundle] Name converter of Serializer
1 parent d7c9085 commit 7a4d9fc

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

components/serializer.rst

+2
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ method on the normalizer definition::
344344
$serializer = new Serializer(array($normalizer), array($encoder));
345345
$serializer->serialize($person, 'json'); // Output: {"name":"foo","sportsman":false}
346346

347+
.. _component-serializer-converting-property-names-when-serializing-and-deserializing:
348+
347349
Converting Property Names when Serializing and Deserializing
348350
------------------------------------------------------------
349351

cookbook/serializer.rst

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ Here is an example on how to load the
124124
$definition->addTag('serializer.normalizer');
125125
$container->setDefinition('get_set_method_normalizer', $definition);
126126
127+
.. _cookbook-serializer-using-serialization-groups-annotations:
128+
127129
Using Serialization Groups Annotations
128130
--------------------------------------
129131

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

175+
.. _cookbook-serializer-enabling-metadata-cache:
176+
173177
Enabling the Metadata Cache
174178
---------------------------
175179

reference/configuration/framework.rst

+47-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Configuration
9292
* `validation`_
9393
* :ref:`enabled <reference-validation-enabled>`
9494
* :ref:`cache <reference-validation-cache>`
95-
* `enable_annotations`_
95+
* :ref:`enable_annotations <reference-validation-enable_annotations>`
9696
* `translation_domain`_
9797
* `strict_email`_
9898
* `api`_
@@ -102,6 +102,9 @@ Configuration
102102
* `debug`_
103103
* `serializer`_
104104
* :ref:`enabled <reference-serializer-enabled>`
105+
* :ref:`cache <reference-serializer-cache>`
106+
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
107+
* `name_converter`_
105108

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

1378+
.. _reference-validation-enable_annotations:
1379+
13751380
enable_annotations
13761381
..................
13771382

@@ -1478,7 +1483,47 @@ enabled
14781483

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

1481-
For more details, see :doc:`/cookbook/serializer`.
1486+
.. _reference-serializer-cache:
1487+
1488+
cache
1489+
.....
1490+
1491+
**type**: ``string``
1492+
1493+
The service that is used to persist class metadata in a cache. The service
1494+
has to implement the :class:`Doctrine\\Common\\Cache\\Cache` interface.
1495+
1496+
.. seealso::
1497+
1498+
For more information, see :ref:`cookbook-serializer-enabling-metadata-cache`.
1499+
1500+
.. _reference-serializer-enable_annotations:
1501+
1502+
enable_annotations
1503+
..................
1504+
1505+
**type**: ``boolean`` **default**: ``false``
1506+
1507+
If this option is enabled, serialization groups can be defined using annotations.
1508+
1509+
.. seealso::
1510+
1511+
For more information, see :ref:`cookbook-serializer-using-serialization-groups-annotations`.
1512+
1513+
name_converter
1514+
..............
1515+
1516+
**type**: ``string``
1517+
1518+
The name converter to use.
1519+
The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter`
1520+
name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case``
1521+
value.
1522+
1523+
.. seealso::
1524+
1525+
For more information, see
1526+
:ref:`component-serializer-converting-property-names-when-serializing-and-deserializing`.
14821527

14831528
Full Default Configuration
14841529
--------------------------

0 commit comments

Comments
 (0)