Skip to content

Commit 77dbc19

Browse files
committed
Reword
1 parent 5005509 commit 77dbc19

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

doctrine/events.rst

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ define a listener for the ``postUpdate`` Doctrine event::
239239
{
240240
// the entity listener methods receive two arguments:
241241
// the entity instance and the lifecycle event
242-
public function checkUserChanges(User $user, LifecycleEventArgs $event)
242+
public function postUpdate(User $user, LifecycleEventArgs $event)
243243
{
244244
// ... do something to notify the changes
245245
}
@@ -260,21 +260,23 @@ with the ``doctrine.orm.entity_listener`` tag:
260260
App\EventListener\UserChangedNotifier:
261261
tags:
262262
-
263-
# these are the basic options that define the entity listener
263+
# these are the options required to define the entity listener
264264
name: 'doctrine.orm.entity_listener'
265265
event: 'postUpdate'
266266
entity: 'App\Entity\User'
267267
268+
# these are other options that you may define if needed
269+
268270
# set the 'lazy' option to TRUE to only instantiate listeners when they are used
269-
lazy: true
271+
# lazy: true
270272
271-
# you can also associate an entity listener to a specific entity manager
272-
entity_manager: 'custom'
273+
# set the 'entity_manager' option if the listener is not associated to the default manager
274+
# entity_manager: 'custom'
273275
274276
# by default, Symfony looks for a method called after the event (e.g. postUpdate())
275277
# if it doesn't exist, it tries to execute the '__invoke()' method, but you can
276278
# configure a custom method name with the 'method' option
277-
method: 'checkUserChanges'
279+
# method: 'checkUserChanges'
278280
279281
.. code-block:: xml
280282
@@ -287,11 +289,15 @@ with the ``doctrine.orm.entity_listener`` tag:
287289
288290
<service id="App\EventListener\UserChangedNotifier">
289291
<!--
290-
* 'event' and 'entity' are the basic options that define the entity listener
291-
* 'lazy': if TRUE, listeners are only instantiated when they are used
292-
* 'entity_manager': define it if the listener is not associated to the
293-
* default entity manager
294-
* 'method': by default, Symfony looks for a method called after the event (e.g. postUpdate())
292+
* These are the options required to define the entity listener:
293+
* * name
294+
* * event
295+
* * entity
296+
*
297+
* These are other options that you may define if needed:
298+
* * lazy: if TRUE, listeners are only instantiated when they are used
299+
* * entity_manager: define it if the listener is not associated to the default manager
300+
* * method: by default, Symfony looks for a method called after the event (e.g. postUpdate())
295301
* if it doesn't exist, it tries to execute the '__invoke()' method, but
296302
* you can configure a custom method name with the 'method' option
297303
-->
@@ -313,20 +319,22 @@ with the ``doctrine.orm.entity_listener`` tag:
313319
314320
$container->autowire(UserChangedNotifier::class)
315321
->addTag('doctrine.orm.entity_listener', [
316-
// these are the basic options that define the entity listener
322+
// These are the options required to define the entity listener:
317323
'event' => 'postUpdate',
318324
'entity' => User::class,
319325
326+
// These are other options that you may define if needed:
327+
320328
// set the 'lazy' option to TRUE to only instantiate listeners when they are used
321-
'lazy' => true,
329+
// 'lazy' => true,
322330
323-
// you can also associate an entity listener to a specific entity manager
324-
'entity_manager' => 'custom',
331+
// set the 'entity_manager' option if the listener is not associated to the default manager
332+
// 'entity_manager' => 'custom',
325333
326334
// by default, Symfony looks for a method called after the event (e.g. postUpdate())
327335
// if it doesn't exist, it tries to execute the '__invoke()' method, but you can
328336
// configure a custom method name with the 'method' option
329-
'method' => 'checkUserChanges',
337+
// 'method' => 'checkUserChanges',
330338
])
331339
;
332340

0 commit comments

Comments
 (0)