Skip to content

Commit c9bb545

Browse files
committed
Fixed code examples in cookbook/service_container
1 parent 1f52ad4 commit c9bb545

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

cookbook/service_container/compiler_passes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ can read about how to create them in the components section ":doc:`/components/d
1111
To register a compiler pass from a bundle you need to add it to the build
1212
method of the bundle definition class::
1313

14+
// src/Acme/MailerBundle/AcmeMailerBundle.php
1415
namespace Acme\MailerBundle;
1516

1617
use Symfony\Component\HttpKernel\Bundle\Bundle;

cookbook/service_container/event_listener.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ using a special "tag":
5252

5353
.. code-block:: yaml
5454
55+
# app/config/config.yml
5556
services:
5657
kernel.listener.your_listener_name:
5758
class: Acme\DemoBundle\Listener\AcmeExceptionListener
@@ -60,12 +61,14 @@ using a special "tag":
6061
6162
.. code-block:: xml
6263
64+
<!-- app/config/config.yml -->
6365
<service id="kernel.listener.your_listener_name" class="Acme\DemoBundle\Listener\AcmeExceptionListener">
6466
<tag name="kernel.event_listener" event="kernel.exception" method="onKernelException" />
6567
</service>
6668
6769
.. code-block:: php
6870
71+
// app/config/config.yml
6972
$container
7073
->register('kernel.listener.your_listener_name', 'Acme\DemoBundle\Listener\AcmeExceptionListener')
7174
->addTag('kernel.event_listener', array('event' => 'kernel.exception', 'method' => 'onKernelException'))
@@ -101,7 +104,7 @@ done as follow::
101104
return;
102105
}
103106

104-
// your code
107+
// ...
105108
}
106109
}
107110

cookbook/service_container/scopes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ In these cases, you should pass the entire container into your service and
119119
retrieve your dependency from the container each time we need it to be sure
120120
you have the right instance::
121121

122+
// src/Acme/HelloBundle/Mail/Mailer.php
122123
namespace Acme\HelloBundle\Mail;
123124

124125
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -135,7 +136,7 @@ you have the right instance::
135136
public function sendEmail()
136137
{
137138
$request = $this->container->get('request');
138-
// Do something using the request here
139+
// ... do something using the request here
139140
}
140141
}
141142

0 commit comments

Comments
 (0)