Skip to content

Commit 1a0494f

Browse files
committed
Begin the normalizers doc
1 parent 0071c91 commit 1a0494f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

components/serializer/encoders.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Encoders
55
========
66

7-
Encoders basically turn **arrays** into specific **formats** and vice versa.
8-
They implement :class:`Symfony\\Component\\Serializer\\Encoder\\EncoderInterface` for encoding (arrays to specific formats) and :class:`Symfony\\Component\\Serializer\\Encoder\\DecoderInterface` for decoding (specific formats to arrays).
7+
Encoders basically turn **arrays** into **formats** and vice versa.
8+
They implement :class:`Symfony\\Component\\Serializer\\Encoder\\EncoderInterface` for encoding (array to format) and :class:`Symfony\\Component\\Serializer\\Encoder\\DecoderInterface` for decoding (format to array).
99

1010
You can add new encoders to a Serializer instance by using its second constructor argument::
1111

components/serializer/normalizers.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,21 @@
33

44
Normalizers
55
===========
6+
7+
Normalizers turn **objects** into **arrays** and vice-versa.
8+
They implement :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` for normalizing (object to array) and :class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface` for denormalizing (array to object).
9+
10+
You can add new normalizers to a Serializer instance by using its first constructor argument::
11+
12+
use Symfony\Component\Serializer\Serializer;
13+
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
14+
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
15+
16+
$normalizers = array(new ArrayDenormalizer(), new GetSetMethodNormalizer());
17+
$serializer = new Serializer($normalizers);
18+
19+
Built-in encoders
20+
-----------------
21+
22+
The Serializer Component provides several normalizers for most use cases:
23+
*

0 commit comments

Comments
 (0)