@@ -252,27 +252,29 @@ that will be used by the normalizer must be aware of the format to use.
252
252
The following code shows how to initialize the :class: `Symfony\\ Component\\ Serializer\\ Mapping\\ Factory\\ ClassMetadataFactory `
253
253
for each format:
254
254
255
- * Annotations in PHP files ::
255
+ .. configuration-block ::
256
256
257
- use Doctrine\Common\Annotations\AnnotationReader;
258
- use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
259
- use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
257
+ .. code-block :: php-annotations
260
258
261
- $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
259
+ use Doctrine\Common\Annotations\AnnotationReader;
260
+ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
261
+ use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
262
262
263
- * XML files::
263
+ $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
264
264
265
- use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
266
- use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
265
+ .. code-block :: yaml
266
+
267
+ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
268
+ use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
267
269
268
- $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader ('/path/to/your/definition.xml '));
270
+ $classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader ('/path/to/your/definition.yml '));
269
271
270
- * YAML files::
272
+ .. code-block :: xml
271
273
272
- use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
273
- use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader ;
274
+ use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
275
+ use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader ;
274
276
275
- $classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader ('/path/to/your/definition.yml '));
277
+ $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader ('/path/to/your/definition.xml '));
276
278
277
279
.. _component-serializer-attributes-groups-annotations :
278
280
0 commit comments