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

Commita8d43df

Browse files
committed
minor#8655 More Symfony 4 updates for the service tags article (javiereguiluz)
This PR was merged into the master branch.Discussion----------More Symfony 4 updates for the service tags articleCommits-------eb77bd9 More Symfony 4 updates for the service tags article
2 parentsdf0d28f +eb77bd9 commita8d43df

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

‎service_container/tags.rst‎

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ Then, define the chain as a service:
129129

130130
..code-block::yaml
131131
132+
# config/services.yaml
132133
services:
133134
App\Mail\TransportChain:~
134135
135136
..code-block::xml
136137
138+
<!-- config/services.xml-->
137139
<?xml version="1.0" encoding="UTF-8" ?>
138140
<containerxmlns="http://symfony.com/schema/dic/services"
139141
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -147,6 +149,7 @@ Then, define the chain as a service:
147149
148150
..code-block::php
149151
152+
// config/services.php
150153
use App\Mail\TransportChain;
151154
152155
$container->autowire(TransportChain::class);
@@ -162,6 +165,7 @@ For example, you may add the following transports as services:
162165

163166
..code-block::yaml
164167
168+
# config/services.yaml
165169
services:
166170
Swift_SmtpTransport:
167171
arguments:['%mailer_host%']
@@ -172,6 +176,7 @@ For example, you may add the following transports as services:
172176
173177
..code-block::xml
174178
179+
<!-- config/services.xml-->
175180
<?xml version="1.0" encoding="UTF-8" ?>
176181
<containerxmlns="http://symfony.com/schema/dic/services"
177182
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -193,6 +198,7 @@ For example, you may add the following transports as services:
193198
194199
..code-block::php
195200
201+
// config/services.php
196202
$container->register(\Swift_SmtpTransport::class)
197203
->addArgument('%mailer_host%')
198204
->addTag('app.mail_transport');
@@ -245,18 +251,18 @@ Register the Pass with the Container
245251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
246252

247253
In order to run the compiler pass when the container is compiled, you have to
248-
add the compiler pass to the container inthe ``build()`` method of your
249-
bundle::
254+
add the compiler pass to the container ina:doc:`bundle extension</bundles/extension>`
255+
or from your kernel::
250256

251-
// src/AppBundle.php
252-
253-
// ...
254-
use Symfony\Component\DependencyInjection\ContainerBuilder;
257+
// src/Kernel.php
255258
use App\DependencyInjection\Compiler\MailTransportPass;
259+
// ...
256260

257-
classAppBundle extendsBundle
261+
classKernel extendsKernel
258262
{
259-
public function build(ContainerBuilder $container)
263+
// ...
264+
265+
protected function build(ContainerBuilder $container)
260266
{
261267
$container->addCompilerPass(new MailTransportPass());
262268
}
@@ -310,6 +316,7 @@ To answer this, change the service declaration:
310316

311317
..code-block::yaml
312318
319+
# config/services.yaml
313320
services:
314321
Swift_SmtpTransport:
315322
arguments:['%mailer_host%']
@@ -322,6 +329,7 @@ To answer this, change the service declaration:
322329
323330
..code-block::xml
324331
332+
<!-- config/services.xml-->
325333
<?xml version="1.0" encoding="UTF-8" ?>
326334
<containerxmlns="http://symfony.com/schema/dic/services"
327335
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -343,6 +351,7 @@ To answer this, change the service declaration:
343351
344352
..code-block::php
345353
354+
// config/services.php
346355
$container->register(\Swift_SmtpTransport::class)
347356
->addArgument('%mailer_host%')
348357
->addTag('app.mail_transport', array('alias' => 'foo'));
@@ -358,8 +367,8 @@ To answer this, change the service declaration:
358367

359368
..code-block::yaml
360369
370+
# config/services.yaml
361371
services:
362-
363372
# Compact syntax
364373
Swift_SendmailTransport:
365374
class:\Swift_SendmailTransport

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp