@@ -483,7 +483,7 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
483
483
484
484
.. note ::
485
485
486
- You can also implement
486
+ You can also implement
487
487
:class: `Symfony\\ Component\\ Serializer\\ NameConverter\\ AdvancedNameConverterInterface `
488
488
to access to the current class name, format and context.
489
489
@@ -534,8 +534,8 @@ processes::
534
534
Configure name conversion using metadata
535
535
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
536
536
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 >`,
539
539
this is already set up and you only need to provide the configuration. Otherwise::
540
540
541
541
// ...
@@ -567,7 +567,7 @@ defines a ``Person`` entity with a ``firstName`` property:
567
567
class Person
568
568
{
569
569
/**
570
- * @SerializedName("firstname ")
570
+ * @SerializedName("customer_name ")
571
571
*/
572
572
private $firstName;
573
573
@@ -584,7 +584,7 @@ defines a ``Person`` entity with a ``firstName`` property:
584
584
App\Entity\Person :
585
585
attributes :
586
586
firstName :
587
- serialized_name : firstname
587
+ serialized_name : customer_name
588
588
589
589
.. code-block :: xml
590
590
@@ -595,14 +595,15 @@ defines a ``Person`` entity with a ``firstName`` property:
595
595
http://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
596
596
>
597
597
<class name =" App\Entity\Person" >
598
- <attribute name =" firstName" serialized-name =" firstname " />
598
+ <attribute name =" firstName" serialized-name =" customer_name " />
599
599
</class >
600
600
</serializer >
601
601
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::
603
604
604
605
$serialized = $serializer->serialize(new Person("Kévin"));
605
- // {"firstname ": "Kévin"}
606
+ // {"customer_name ": "Kévin"}
606
607
607
608
Serializing Boolean Attributes
608
609
------------------------------
0 commit comments