Skip to content

Commit d8bb849

Browse files
Reworded and added the versionadded directive
1 parent 601450e commit d8bb849

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

doctrine/event_listeners_subscribers.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,17 @@ interface and have an event method for each event it subscribes to::
186186

187187
For a full reference, see chapter `The Event System`_ in the Doctrine documentation.
188188

189-
Performance considerations
190-
--------------------------------
189+
Performance Considerations
190+
--------------------------
191191

192-
One subtle difference between listeners and subscribers is that Symfony will load
193-
entity listeners lazily by default as of Symfony 4.2. This means that your listener class will only be fetched
194-
from the service container (and thus be instantiated) once the event it is linked
195-
to actually fires.
192+
One important difference between listeners and subscribers is that Symfony loads
193+
entity listeners lazily. This means that the listener classes are only fetched
194+
from the service container (and instantiated) if the related event is actually
195+
fired.
196196

197-
So whenever possible it is preferable to use entity listeners instead of subscribers.
197+
That's why it is preferable to use entity listeners instead of subscribers
198+
whenever possible.
199+
200+
.. versionadded:: 4.2
201+
The default lazy behavior of Doctrine entity listeners was introduced in
202+
Symfony 4.2.

0 commit comments

Comments
 (0)