@@ -129,11 +129,13 @@ Then, define the chain as a service:
129129
130130 ..code-block ::yaml
131131
132+ # config/services.yaml
132133services :
133134App\Mail\TransportChain :~
134135
135136 ..code-block ::xml
136137
138+ <!-- config/services.xml-->
137139 <?xml version =" 1.0" encoding =" UTF-8" ?>
138140 <container xmlns =" http://symfony.com/schema/dic/services"
139141xmlns : 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
165169services :
166170Swift_SmtpTransport :
167171arguments :['%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 <container xmlns =" http://symfony.com/schema/dic/services"
177182xmlns : 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
247253In 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
313320services :
314321Swift_SmtpTransport :
315322arguments :['%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 <container xmlns =" http://symfony.com/schema/dic/services"
327335xmlns : 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
361371services :
362-
363372# Compact syntax
364373Swift_SendmailTransport :
365374class :\Swift_SendmailTransport