@@ -163,27 +163,23 @@ The definition of serialization can be specified using annotations, XML
163
163
and YAML. The :class: Symfony\C omponent\S erializer\M apping\F actory\C lassMetadataFactory
164
164
that will be used by the normalizer must be aware of the format to use.
165
165
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
167
167
like the following::
168
168
169
- use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
170
169
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;
171
177
172
178
$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'));
187
183
188
184
Then, create your groups definition:
189
185
@@ -258,11 +254,11 @@ Ignoring Attributes
258
254
-------------------
259
255
260
256
.. versionadded :: 2.3
261
- The :method: `GetSetMethodNormalizer::setIgnoredAttributes< Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer::setIgnoredAttributes> `
257
+ The :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer::setIgnoredAttributes `
262
258
method was introduced in Symfony 2.3.
263
259
264
260
.. 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
266
262
2.7, they are ignored when deserializing too.
267
263
268
264
As an option, there's a way to ignore attributes from the origin object. To remove
0 commit comments