From d9b62bb7a9f9e4239656d75f13071d01a1bc8e5f Mon Sep 17 00:00:00 2001 From: cedric lombardot Date: Thu, 5 Jan 2023 12:00:55 +0100 Subject: [PATCH] We need to use AsEntityListener instead of AsDoctrineListener --- doctrine/events.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doctrine/events.rst b/doctrine/events.rst index 59fe440c2b6..77d25db35ac 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -255,7 +255,7 @@ First, define a PHP class that handles the ``postUpdate`` Doctrine event:: } } -Then, add the ``#[AsDoctrineListener]`` attribute to the class to enable it as +Then, add the ``#[AsEntityListener]`` attribute to the class to enable it as a Doctrine entity listener in your application: .. code-block:: php @@ -265,9 +265,10 @@ a Doctrine entity listener in your application: // ... use App\Entity\User; - use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; + use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener; + use Doctrine\ORM\Events; - #[AsDoctrineListener(event: 'postUpdate', method: 'postUpdate', entity: User::class)] + #[AsEntityListener(event: Events::postUpdate, method: 'postUpdate', entity: User::class)] class UserChangedNotifier { // ...