Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9818ea3

Browse filesBrowse files
committed
Changing bad event names - postSave preSave to postPersist prePersist
1 parent f3a0765 commit 9818ea3
Copy full SHA for 9818ea3

File tree

Expand file treeCollapse file tree

1 file changed

+8
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-8
lines changed

‎cookbook/doctrine/event_listeners_subscribers.rst

Copy file name to clipboardExpand all lines: cookbook/doctrine/event_listeners_subscribers.rst
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Registering Event Listeners and Subscribers
66
Doctrine packages a rich event system that fires events when almost anything
77
happens inside the system. For you, this means that you can create arbitrary
88
:doc:`services</book/service_container>` and tell Doctrine to notify those
9-
objects whenever a certain action (e.g. ``preSave``) happens within Doctrine.
9+
objects whenever a certain action (e.g. ``prePersist``) happens within Doctrine.
1010
This could be useful, for example, to create an independent search index
1111
whenever an object in your database is saved.
1212

@@ -39,11 +39,11 @@ managers that use this connection.
3939
my.listener:
4040
class: Acme\SearchBundle\Listener\SearchIndexer
4141
tags:
42-
- { name: doctrine.event_listener, event: postSave }
42+
- { name: doctrine.event_listener, event: postPersist }
4343
my.listener2:
4444
class: Acme\SearchBundle\Listener\SearchIndexer2
4545
tags:
46-
- { name: doctrine.event_listener, event: postSave, connection: default }
46+
- { name: doctrine.event_listener, event: postPersist, connection: default }
4747
my.subscriber:
4848
class: Acme\SearchBundle\Listener\SearchIndexerSubscriber
4949
tags:
@@ -63,10 +63,10 @@ managers that use this connection.
6363
6464
<services>
6565
<service id="my.listener" class="Acme\SearchBundle\Listener\SearchIndexer">
66-
<tag name="doctrine.event_listener" event="postSave" />
66+
<tag name="doctrine.event_listener" event="postPersist" />
6767
</service>
6868
<service id="my.listener2" class="Acme\SearchBundle\Listener\SearchIndexer2">
69-
<tag name="doctrine.event_listener" event="postSave" connection="default" />
69+
<tag name="doctrine.event_listener" event="postPersist" connection="default" />
7070
</service>
7171
<service id="my.subscriber" class="Acme\SearchBundle\Listener\SearchIndexerSubscriber">
7272
<tag name="doctrine.event_subscriber" connection="default" />
@@ -78,8 +78,8 @@ Creating the Listener Class
7878
---------------------------
7979

8080
In the previous example, a service ``my.listener`` was configured as a Doctrine
81-
listener on the event ``postSave``. That class behind that service must have
82-
a ``postSave`` method, which will be called when the event is thrown::
81+
listener on the event ``postPersist``. That class behind that service must have
82+
a ``postPersist`` method, which will be called when the event is thrown::
8383

8484
// src/Acme/SearchBundle/Listener/SearchIndexer.php
8585
namespace Acme\SearchBundle\Listener;
@@ -89,7 +89,7 @@ a ``postSave`` method, which will be called when the event is thrown::
8989
9090
class SearchIndexer
9191
{
92-
public function postSave(LifecycleEventArgs $args)
92+
public function postPersist(LifecycleEventArgs $args)
9393
{
9494
$entity = $args->getEntity();
9595
$entityManager = $args->getEntityManager();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.