Skip to content

Commit

Permalink
Update examples in entity listeners documentation
Browse files Browse the repository at this point in the history
The code example is weirdly misleading because the same class is attached to the `preUpdate` event twice. Furthermore, the YAML example is wrong and inconsistent with the XML example. This PR fixes that.
  • Loading branch information
YetiCGN committed Feb 1, 2019
1 parent 98551d7 commit 568caa6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Resources/doc/entity-listeners.rst
Expand Up @@ -14,7 +14,10 @@ entity manager it should be registered with. Example:
user_listener:
class: \UserListener
tags:
- { name: doctrine.orm.entity_listener }
-
name: doctrine.orm.entity_listener
event: postPersist
entity: App\Entity\User
-
name: doctrine.orm.entity_listener
event: preUpdate
Expand All @@ -29,7 +32,11 @@ entity manager it should be registered with. Example:
<services>
<service id="user_listener" class="UserListener">
<tag name="doctrine.orm.entity_listener" event="preUpdate" entity="App\Entity\User" />
<tag
name="doctrine.orm.entity_listener"
event="postPersist"
entity="App\Entity\User"
/>
<tag
name="doctrine.orm.entity_listener"
event="preUpdate"
Expand Down

0 comments on commit 568caa6

Please sign in to comment.