Skip to content

Commit 357ad55

Browse files
committed
layout fixes
1 parent 26077b5 commit 357ad55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cookbook/doctrine/event_listeners_subscribers.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ Creating the Listener Class
120120

121121
In the previous example, a service ``my.listener`` was configured as a Doctrine
122122
listener on the event ``postPersist``. That class behind that service must have
123-
a ``postPersist`` method, which will be called when the event is thrown::
123+
a ``postPersist`` method, which will be called when the event is thrown.
124+
125+
.. code-block::php
124126
125127
// src/Acme/SearchBundle/EventListener/SearchIndexer.php
126128
namespace Acme\SearchBundle\EventListener;
@@ -158,6 +160,7 @@ Creating the Subscriber Class
158160
A doctrine event subscriber must implement the ``Doctrine\Common\EventSubscriber``
159161
interface and an event method for each event it subscribes to.
160162

163+
.. code-block::php
161164
162165
// src/Acme/SearchBundle/EventListener/SearchIndexerSubscriber.php
163166
namespace Acme\SearchBundle\EventListener;
@@ -175,14 +178,17 @@ interface and an event method for each event it subscribes to.
175178
'postUpdate',
176179
);
177180
}
181+
178182
public function postUpdate(LifecycleEventArgs $args)
179183
{
180184
$this->index($args);
181185
}
186+
182187
public function postPersist(LifecycleEventArgs $args)
183188
{
184189
$this->index($args);
185190
}
191+
186192
public function index(LifecycleEventArgs $args)
187193
{
188194
$entity = $args->getEntity();
@@ -195,7 +201,7 @@ interface and an event method for each event it subscribes to.
195201
}
196202
}
197203
198-
.. hint::
204+
.. tip::
199205

200206
Doctrine event subscribers can not return a flexible array of methods to
201207
call for the events like the :ref:`Symfony event subscriber <event_dispatcher-using-event-subscribers>`

0 commit comments

Comments
 (0)