Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions docs/en/entity-listeners.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,4 @@ back on the ``__invoke()`` method.

See also
https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#entity-listeners
for more info on entity listeners and the resolver required by Symfony.

Lazy Entity Listeners
---------------------

You can use the ``lazy`` attribute on the tag to make sure the listener services
are only instantiated when they are actually used.

.. configuration-block::

.. code-block:: yaml

services:
App\UserListener:
tags:
- { name: doctrine.orm.entity_listener, lazy: true }

.. code-block:: xml

<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<services>
<service id="App\UserListener">
<tag name="doctrine.orm.entity_listener" event="preUpdate" entity="App\Entity\User" lazy="true" />
</service>
</services>
</container>
for more info on entity listeners and the resolver required by Symfony.