8000 minor #17472 [Doctrine] Add documentation about Doctrine `AsEventList… · symfony/symfony-docs@c51f145 · GitHub
[go: up one dir, main page]

Skip to content

Commit c51f145

Browse files
committed
minor #17472 [Doctrine] Add documentation about Doctrine AsEventListener (jderusse)
This PR was merged into the 6.2 branch. Discussion ---------- [Doctrine] Add documentation about Doctrine `AsEventListener` Related to the **NOT YET MERGED** PR doctrine/DoctrineBundle#1583 Commits ------- e97a574 Add documentation about doctrine's AsEventListener
2 parents c6abb15 + e97a574 commit c51f145

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.doctor-rst.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ whitelist:
8181
- '#. The most important config file is ``app/config/services.yml``, which now is'
8282
- 'The bin/console Command'
8383
- '.. _`LDAP injection`: http://projects.webappsec.org/w/page/13246947/LDAP%20Injection'
84+
- '.. versionadded:: 2.7.2' # Doctrine
8485
- '.. versionadded:: 1.9.0' # Encore
8586
- '.. versionadded:: 1.11' # Messenger (Middleware / DoctrineBundle)
8687
- '.. versionadded:: 1.18' # Flex in setup/upgrade_minor.rst

doctrine/events.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,23 @@ listener in the Symfony application by creating a new service for it and
164164

165165
.. configuration-block::
166166

167+
.. code-block:: attribute
168+
169+
// src/App/EventListener/SearchIndexer.php
170+
namespace App\EventListener;
171+
172+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEventListener;
173+
use Doctrine\ORM\Event\LifecycleEventArgs;
174+
175+
#[AsEventListener('postPersist'/*, 500, 'default'*/)]
176+
class SearchIndexer
177+
{
178+
public function postPersist(LifecycleEventArgs $event): void
179+
{
180+
// ...
181+
}
182+
}
183+
167184
.. code-block:: yaml
168185
169186
# config/services.yaml
@@ -234,6 +251,12 @@ listener in the Symfony application by creating a new service for it and
234251
;
235252
};
236253
254+
255+
.. versionadded:: 2.7.2
256+
257+
The :class:`Doctrine\\Bundle\\DoctrineBundle\\Attribute\\AsEventListener`
258+
attribute was introduced in DoctrineBundle 2.7.2.
259+
237260
.. tip::
238261

239262
Symfony loads (and instantiates) Doctrine listeners only when the related

0 commit comments

Comments
 (0)
0