Skip to content

We need to use AsEntityListener instead of AsDoctrineListener #17661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions doctrine/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
// ...
Expand Down