Skip to content

Commit bacdc6f

Browse files
committed
Use a configuration-block directive
1 parent f40aa53 commit bacdc6f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

components/serializer.rst

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -252,27 +252,29 @@ that will be used by the normalizer must be aware of the format to use.
252252
The following code shows how to initialize the :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory`
253253
for each format:
254254

255-
* Annotations in PHP files::
255+
.. configuration-block::
256256

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
260258
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;
262262
263-
* XML files::
263+
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
264264
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;
267269
268-
$classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml'));
270+
$classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader('/path/to/your/definition.yml'));
269271
270-
* YAML files::
272+
.. code-block:: xml
271273
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;
274276
275-
$classMetadataFactory = new ClassMetadataFactory(new YamlFileLoader('/path/to/your/definition.yml'));
277+
$classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml'));
276278
277279
.. _component-serializer-attributes-groups-annotations:
278280

0 commit comments

Comments
 (0)