@@ -16,9 +16,17 @@ whenever an object in your database is saved.
16
16
17
17
Doctrine defines two types of objects that can listen to Doctrine events:
18
18
listeners and subscribers. Both are very similar, but listeners are a bit
19
- more straightforward. For more, see `The Event System `_ on Doctrine's website .
19
+ more straightforward. For more, see `The Event System `_ on Doctrine's documentation .
20
20
21
- The Doctrine website also explains all existing events that can be listened to.
21
+ Before using them, keep in mind that Doctrine events are intended for
22
+ persistence hooks (i.e. *"save also this when saving that" *). They should not be
23
+ used for domain logic, such as logging changes, setting ``updatedAt `` and
24
+ ``createdAt `` properties, etc.
25
+
26
+ .. seealso ::
27
+
28
+ This article covers listeners and subscribers for Doctrine ORM. If you are
29
+ using ODM for MongoDB, read the `DoctrineMongoDBBundle documentation `_.
22
30
23
31
Configuring the Listener/Subscriber
24
32
-----------------------------------
@@ -85,11 +93,6 @@ managers that use this connection.
85
93
->addTag('doctrine.event_subscriber', ['connection' => 'default'])
86
94
;
87
95
88
- .. tip ::
89
-
90
- If you're using Doctrine with MongoDB, you should use ``doctrine_mongodb.odm.event_listener ``
91
- as the tag name for the event listener service.
92
-
93
96
Creating the Listener Class
94
97
---------------------------
95
98
@@ -302,3 +305,4 @@ numbers mean that listeners are invoked earlier.
302
305
303
306
.. _`The Event System` : http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html
304
307
.. _`the DoctrineBundle documentation` : https://symfony.com/doc/current/bundles/DoctrineBundle/entity-listeners.html
308
+ .. _`DoctrineMongoDBBundle documentation` : https://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html
0 commit comments