Skip to content

Commit

Permalink
Merge pull request #1161 from huebs/patch-1
Browse files Browse the repository at this point in the history
Update Entity Listener Docs to New Service Style
  • Loading branch information
alcaeus committed May 19, 2020
2 parents 4b7885b + bd8809a commit 0ea57dc
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Resources/doc/entity-listeners.rst
Expand Up @@ -18,7 +18,7 @@ Full example:
/**
* @ORM\Entity
* @ORM\EntityListeners({"UserListener"})
* @ORM\EntityListeners({"App\UserListener"})
*/
class User
{
Expand All @@ -31,8 +31,7 @@ Full example:
.. code-block:: yaml
services:
user_listener:
class: \UserListener
App\UserListener:
tags:
# Minimal configuration below
- { name: doctrine.orm.entity_listener }
Expand All @@ -46,7 +45,7 @@ Full example:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<services>
<service id="user_listener" class="UserListener">
<service id="App\UserListener">
<!-- entity_manager attribute is optional -->
<tag name="doctrine.orm.entity_listener" entity_manager="custom" />
</service>
Expand All @@ -62,8 +61,7 @@ definition:
.. code-block:: yaml
services:
user_listener:
class: \UserListener
App\UserListener:
tags:
-
name: doctrine.orm.entity_listener
Expand All @@ -81,7 +79,7 @@ definition:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<services>
<service id="user_listener" class="UserListener">
<service id="App\UserListener">
<!-- entity_manager attribute is optional -->
<!-- method attribute is optional -->
<tag
Expand Down Expand Up @@ -116,8 +114,7 @@ are only instantiated when they are actually used.
.. code-block:: yaml
services:
lazy_user_listener:
class: \UserListener
App\UserListener:
tags:
- { name: doctrine.orm.entity_listener, lazy: true }
Expand All @@ -129,7 +126,7 @@ are only instantiated when they are actually used.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<services>
<service id="lazy_user_listener" class="UserListener">
<service id="App\UserListener">
<tag name="doctrine.orm.entity_listener" event="preUpdate" entity="App\Entity\User" lazy="true" />
</service>
</services>
Expand Down

0 comments on commit 0ea57dc

Please sign in to comment.