Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteb92038

Browse files
committed
[Serializer] update doc for 3.4 about normalizer
1 parent3c2b8c6 commiteb92038

File tree

1 file changed

+8
-38
lines changed

1 file changed

+8
-38
lines changed

‎serializer/custom_normalizer.rst‎

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,45 +53,15 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``:
5353
}
5454
}
5555

56-
Registering it in Your Application
57-
----------------------------------
58-
59-
In order to enable the normalizer in an application based on the entire Symfony
60-
framework, you must register it as a service and:doc:`tag it</service_container/tags>`
61-
with ``serializer.normalizer``.
62-
63-
..configuration-block::
64-
65-
..code-block::yaml
6656

67-
# app/config/services.yml
68-
services:
69-
app.yaml_encoder:
70-
class:AppBundle\Serializer\TopicNormalizer
71-
tags:
72-
-{ name: serializer.normalizer }
73-
74-
..code-block::xml
75-
76-
<!-- app/config/services.xml-->
77-
<?xml version="1.0" encoding="UTF-8" ?>
78-
<containerxmlns="http://symfony.com/schema/dic/services"
79-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
80-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
81-
82-
<services>
83-
<serviceid="app.yaml_encoder"class="AppBundle\Serializer\TopicNormalizer">
84-
<tagname="serializer.normalizer" />
85-
</service>
86-
</services>
87-
</container>
57+
Registering it in your Application
58+
----------------------------------
8859

89-
..code-block::php
60+
If you use the Symfony Framework. then you probably want to register this normalizer
61+
as a service in your app. If you're using the:ref:`default services.yml configuration<service-container-services-load-example>`,
62+
that's done automatically!
9063

91-
// app/config/services.php
92-
use AppBundle\Serializer\TopicNormalizer;
64+
..tip::
9365

94-
$container
95-
->register('app.yaml_encoder', TopicNormalizer::class)
96-
->addTag('serializer.normalizer')
97-
;
66+
If you're not using autoconfigure, make sure to register your class as a service
67+
and tag it with ``serializer.normalizer``.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp