Skip to content

Commit e97a574

Browse files
committed
Add documentation about doctrine's AsEventListener
1 parent b59a1a8 commit e97a574

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
@@ -80,6 +80,7 @@ whitelist:
8080
- 'The bin/console Command'
8181
- '# username is your full Gmail or Google Apps email address'
8282
- '.. _`LDAP injection`: http://projects.webappsec.org/w/page/13246947/LDAP%20Injection'
83+
- '.. versionadded:: 2.7.2' # Doctrine
8384
- '.. versionadded:: 1.9.0' # Encore
8485
- '.. versionadded:: 0.28.4' # Encore
8586
- '.. versionadded:: 2.4.0' # SwiftMailer

doctrine/events.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ with the ``doctrine.event_listener`` tag:
149149

150150
.. configuration-block::
151151

152+
.. code-block:: attribute
153+
154+
// src/App/EventListener/SearchIndexer.php
155+
namespace App\EventListener;
156+
157+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEventListener;
158+
use Doctrine\ORM\Event\LifecycleEventArgs;
159+
160+
#[AsEventListener('postPersist'/*, 500, 'default'*/)]
161+
class SearchIndexer
162+
{
163+
public function postPersist(LifecycleEventArgs $event): void
164+
{
165+
// ...
166+
}
167+
}
168+
152169
.. code-block:: yaml
153170
154171
# config/services.yaml
@@ -219,6 +236,12 @@ with the ``doctrine.event_listener`` tag:
219236
;
220237
};
221238
239+
240+
.. versionadded:: 2.7.2
241+
242+
The :class:`Doctrine\\Bundle\\DoctrineBundle\\Attribute\\AsEventListener`
243+
attribute was introduced in DoctrineBundle 2.7.2.
244+
222245
.. tip::
223246

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

0 commit comments

Comments
 (0)