Skip to content

Commit c5be930

Browse files
sadikoffweaverryan
authored andcommitted
Fix Doctrine Entity Listeners event class
using class `PreUpdateEventArgs` causes exception >Argument 2 passed to App\EventListener\UserChangedNotifier::postUpdate() must be an instance of Doctrine\ORM\Event\PreUpdateEventArgs, instance of Doctrine\ORM\Event\LifecycleEventArgs given, called in .../vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php on line 112
1 parent 8d4022f commit c5be930

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doctrine/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,13 @@ define a listener for the ``postUpdate`` Doctrine event::
233233
namespace App\EventListener;
234234

235235
use App\Entity\User;
236-
use Doctrine\ORM\Event\PreUpdateEventArgs;
236+
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
237237

238238
class UserChangedNotifier
239239
{
240240
// the entity listener methods receive two arguments:
241241
// the entity instance and the lifecycle event
242-
public function postUpdate(User $user, PreUpdateEventArgs $event)
242+
public function postUpdate(User $user, LifecycleEventArgs $event)
243243
{
244244
// ... do something to notify the changes
245245
}

0 commit comments

Comments
 (0)