diff --git a/doctrine/event_listeners_subscribers.rst b/doctrine/event_listeners_subscribers.rst index 6d39d471bd0..ba6e218c5cd 100644 --- a/doctrine/event_listeners_subscribers.rst +++ b/doctrine/event_listeners_subscribers.rst @@ -102,7 +102,7 @@ a ``postPersist()`` method, which will be called when the event is dispatched:: { public function postPersist(LifecycleEventArgs $args) { - $entity = $args->getEntity(); + $entity = $args->getObject(); // only act on some "Product" entity if (!$entity instanceof Product) { @@ -166,7 +166,7 @@ interface and have an event method for each event it subscribes to:: public function index(LifecycleEventArgs $args) { - $entity = $args->getEntity(); + $entity = $args->getObject(); // perhaps you only want to act on some "Product" entity if ($entity instanceof Product) {