@@ -163,27 +163,23 @@ The definition of serialization can be specified using annotations, XML
163163and YAML. The :class: Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
164164that 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\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
166+ Initialize the :class: Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
167167like 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
188184Then, 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
268264As an option, there's a way to ignore attributes from the origin object. To remove
0 commit comments