Skip to content

Commit d9b62bb

Browse files
cedriclombardotjaviereguiluz
authored andcommitted
We need to use AsEntityListener instead of AsDoctrineListener
1 parent 7b93c1f commit d9b62bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doctrine/events.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ First, define a PHP class that handles the ``postUpdate`` Doctrine event::
255255
}
256256
}
257257

258-
Then, add the ``#[AsDoctrineListener]`` attribute to the class to enable it as
258+
Then, add the ``#[AsEntityListener]`` attribute to the class to enable it as
259259
a Doctrine entity listener in your application:
260260

261261
.. code-block:: php
@@ -265,9 +265,10 @@ a Doctrine entity listener in your application:
265265
266266
// ...
267267
use App\Entity\User;
268-
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
268+
use Doctrine\Bundle\DoctrineBundle\Attribute\AsEntityListener;
269+
use Doctrine\ORM\Events;
269270
270-
#[AsDoctrineListener(event: 'postUpdate', method: 'postUpdate', entity: User::class)]
271+
#[AsEntityListener(event: Events::postUpdate, method: 'postUpdate', entity: User::class)]
271272
class UserChangedNotifier
272273
{
273274
// ...

0 commit comments

Comments
 (0)