Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2121344

Browse filesBrowse files
committed
Minor reword
1 parent 9a402c2 commit 2121344
Copy full SHA for 2121344

File tree

1 file changed

+9
-8
lines changed
Filter options

1 file changed

+9
-8
lines changed

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
483483

484484
.. note::
485485

486-
You can also implement
486+
You can also implement
487487
:class:`Symfony\\Component\\Serializer\\NameConverter\\AdvancedNameConverterInterface`
488488
to access to the current class name, format and context.
489489

@@ -534,8 +534,8 @@ processes::
534534
Configure name conversion using metadata
535535
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
536536

537-
When using this component inside a Symfony application and the class metadata factory is enabled
538-
as explained in the :ref:`Attributes Groups section <component-serializer-attributes-groups>`,
537+
When using this component inside a Symfony application and the class metadata
538+
factory is enabled as explained in the :ref:`Attributes Groups section <component-serializer-attributes-groups>`,
539539
this is already set up and you only need to provide the configuration. Otherwise::
540540

541541
// ...
@@ -567,7 +567,7 @@ defines a ``Person`` entity with a ``firstName`` property:
567567
class Person
568568
{
569569
/**
570-
* @SerializedName("firstname")
570+
* @SerializedName("customer_name")
571571
*/
572572
private $firstName;
573573
@@ -584,7 +584,7 @@ defines a ``Person`` entity with a ``firstName`` property:
584584
App\Entity\Person:
585585
attributes:
586586
firstName:
587-
serialized_name: firstname
587+
serialized_name: customer_name
588588
589589
.. code-block:: xml
590590
@@ -595,14 +595,15 @@ defines a ``Person`` entity with a ``firstName`` property:
595595
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
596596
>
597597
<class name="App\Entity\Person">
598-
<attribute name="firstName" serialized-name="firstname" />
598+
<attribute name="firstName" serialized-name="customer_name" />
599599
</class>
600600
</serializer>
601601
602-
Once configured, the serializer uses the mapping to convert pproperty names when serializing and deserializing::
602+
This custom mapping is used to convert property names when serializing and
603+
deserializing objects::
603604

604605
$serialized = $serializer->serialize(new Person("Kévin"));
605-
// {"firstname": "Kévin"}
606+
// {"customer_name": "Kévin"}
606607

607608
Serializing Boolean Attributes
608609
------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.