Skip to content

Commit 958df16

Browse files
David-Crtyxabbuh
authored andcommitted
Updating doctrine class use
1 parent 9a28e96 commit 958df16

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doctrine/event_listeners_subscribers.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,14 @@ a ``postPersist()`` method, which will be called when the event is dispatched::
130130
{
131131
public function postPersist(LifecycleEventArgs $args)
132132
{
133-
$entity = $args->getEntity();
133+
$object = $args->getObject();
134134

135135
// only act on some "Product" entity
136-
if (!$entity instanceof Product) {
136+
if (!$object instanceof Product) {
137137
return;
138138
}
139139

140-
$entityManager = $args->getEntityManager();
140+
$objectManager = $args->getObjectManager();
141141
// ... do something with the Product
142142
}
143143
}
@@ -168,8 +168,8 @@ interface and have an event method for each event it subscribes to::
168168
namespace AppBundle\EventListener;
169169

170170
use Doctrine\Common\EventSubscriber;
171-
use Doctrine\ORM\Event\LifecycleEventArgs;
172-
// for Doctrine 2.4: Doctrine\Common\Persistence\Event\LifecycleEventArgs;
171+
// for Doctrine < 2.4: use Doctrine\ORM\Event\LifecycleEventArgs;
172+
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
173173
use AppBundle\Entity\Product;
174174

175175
class SearchIndexerSubscriber implements EventSubscriber

0 commit comments

Comments
 (0)