cleanup event subscriber note
This commit is contained in:
parent
220f367658
commit
204c1afe9a
@ -99,11 +99,9 @@ array of events it should be subscribed to.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If you are familiar with the Symfony2 event manager, note that
|
The array to return in the ``getSubscribedEvents`` method is a simple array
|
||||||
the array returned by getSubscribedEvents is different. For
|
with the values being the event names. The subscriber must have a method
|
||||||
doctrine, the array values must be the event names, and the
|
that is named exactly like the event.
|
||||||
names are used as method names that will be called when the
|
|
||||||
event occurs.
|
|
||||||
|
|
||||||
Now when you dispatch an event, any event subscribers will be
|
Now when you dispatch an event, any event subscribers will be
|
||||||
notified for that event.
|
notified for that event.
|
||||||
@ -413,6 +411,7 @@ A lifecycle event subscriber may looks like this:
|
|||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
use Doctrine\ORM\Events;
|
||||||
use Doctrine\Common\EventSubscriber;
|
use Doctrine\Common\EventSubscriber;
|
||||||
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
||||||
|
|
||||||
@ -421,7 +420,7 @@ A lifecycle event subscriber may looks like this:
|
|||||||
public function getSubscribedEvents()
|
public function getSubscribedEvents()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'postUpdate',
|
Events::postUpdate,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user