Skip to content

Commit 7184b11

Browse files
committed
Sone doc fixes.
1 parent 0e1b92f commit 7184b11

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

components/serializer.rst

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,27 +163,23 @@ The definition of serialization can be specified using annotations, XML
163163
and YAML. The :class:Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
164164
that will be used by the normalizer must be aware of the format to use.
165165

166-
If you want to use annotations to define groups, initialize the :class:Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
166+
Initialize the :class:Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
167167
like the following::
168168

169-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
170169
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
170+
// For annotations
171+
usr Doctrine\Common\Annotations\AnnotationReader;
172+
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
173+
// For XML
174+
// use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
175+
// For YAML
176+
// use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
171177

172178
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
173-
174-
If you prefer XML::
175-
176-
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
177-
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
178-
179-
$classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml'));
180-
181-
And for YAML::
182-
183-
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
184-
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
185-
186-
$classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader('/path/to/your/definition.yml'));
179+
// For XML
180+
// $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml'));
181+
// For YAML
182+
// $classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader('/path/to/your/definition.yml'));
187183

188184
Then, create your groups definition:
189185

@@ -258,11 +254,11 @@ Ignoring Attributes
258254
-------------------
259255

260256
.. versionadded:: 2.3
261-
The :method:`GetSetMethodNormalizer::setIgnoredAttributes<Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer::setIgnoredAttributes>`
257+
The :method:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer::setIgnoredAttributes`
262258
method was introduced in Symfony 2.3.
263259

264260
.. versionadded:: 2.7
265-
Before Symfony 2.7, attributes was only ignored while serializing. Since Symfony
261+
Prior to Symfony 2.7, attributes were only ignored while serializing. Since Symfony
266262
2.7, they are ignored when deserializing too.
267263

268264
As an option, there's a way to ignore attributes from the origin object. To remove

0 commit comments

Comments
 (0)