diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 7323d53d1dd..fac523a64da 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -80,6 +80,7 @@ whitelist: - 'The bin/console Command' - '# username is your full Gmail or Google Apps email address' - '.. _`LDAP injection`: http://projects.webappsec.org/w/page/13246947/LDAP%20Injection' + - '.. versionadded:: 2.7.2' # Doctrine - '.. versionadded:: 1.9.0' # Encore - '.. versionadded:: 0.28.4' # Encore - '.. versionadded:: 2.4.0' # SwiftMailer diff --git a/doctrine/events.rst b/doctrine/events.rst index 9a2756a4e61..1b9f2d305a4 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -149,6 +149,23 @@ with the ``doctrine.event_listener`` tag: .. configuration-block:: + .. code-block:: attribute + + // src/App/EventListener/SearchIndexer.php + namespace App\EventListener; + + use Doctrine\Bundle\DoctrineBundle\Attribute\AsEventListener; + use Doctrine\ORM\Event\LifecycleEventArgs; + + #[AsEventListener('postPersist'/*, 500, 'default'*/)] + class SearchIndexer + { + public function postPersist(LifecycleEventArgs $event): void + { + // ... + } + } + .. code-block:: yaml # config/services.yaml @@ -219,6 +236,12 @@ with the ``doctrine.event_listener`` tag: ; }; + +.. versionadded:: 2.7.2 + + The :class:`Doctrine\\Bundle\\DoctrineBundle\\Attribute\\AsEventListener` + attribute was introduced in DoctrineBundle 2.7.2. + .. tip:: Symfony loads (and instantiates) Doctrine listeners only when the related