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

Commitc842209

Browse files
committed
Minor reword and fixes
1 parentdeb369d commitc842209

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

‎service_container/alias_private.rst‎

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,40 +130,36 @@ This means that when using the container directly, you can access the
130130
app.mailer:'@app.phpmailer'
131131
132132
Anonymous Services
133-
--------------------
133+
------------------
134134

135135
..note::
136136

137-
Anonymous services arecurrentlyonly supported by the XML configuration format.
137+
Anonymous services are only supported by the XML configuration format.
138138

139-
In some cases, you may want tolimit access toa serviceoutside of its
140-
intended scope. Thisis useful when you want to prevent other services from
141-
using the service as their own dependency. This can be achieved by creating an
142-
*anonymous service*.
139+
In some cases, you may want topreventa servicebeing used as a dependency of
140+
other services. Thiscan be achieved by creating an anonymous service. These
141+
services are like regular services but they don't define an ID and they are
142+
created where they are used.
143143

144-
For Symfony, an anonymous service is nothing more than a service without a
145-
identifying name which is defined directly in its use context. The following
146-
example shows how an anonymous service can be injected into another service:
144+
The following example shows how to inject an anonymous service into another service:
147145

148-
..configuration-block::
146+
..code-block::xml
149147
150-
..code-block::xml
148+
<!-- app/config/services.xml-->
149+
<?xml version="1.0" encoding="UTF-8" ?>
150+
<containerxmlns="http://symfony.com/schema/dic/services"
151+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
152+
xsi:schemaLocation="http://symfony.com/schema/dic/services
153+
http://symfony.com/schema/dic/services/services-1.0.xsd">
151154
152-
<!-- app/config/services.xml-->
153-
<?xml version="1.0" encoding="UTF-8" ?>
154-
<containerxmlns="http://symfony.com/schema/dic/services"
155-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
156-
xsi:schemaLocation="http://symfony.com/schema/dic/services
157-
http://symfony.com/schema/dic/services/services-1.0.xsd">
158-
159-
<services>
160-
<serviceid="foo"class="AppBundle\Foo">
161-
<argumenttype="service">
162-
<serviceclass="AppBundle\AnonymousBar" />
163-
</argument>
164-
</service>
165-
</services>
166-
</container>
155+
<services>
156+
<serviceid="foo"class="AppBundle\Foo">
157+
<argumenttype="service">
158+
<serviceclass="AppBundle\AnonymousBar" />
159+
</argument>
160+
</service>
161+
</services>
162+
</container>
167163
168164
Deprecating Services
169165
--------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp