Skip to content

Commit 06ff68e

Browse files
committed
minor #7750 Updating doctrine class use (David-Crty)
This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #7750). Discussion ---------- Updating doctrine class use Because now composer.json of symfony 3.2 use doctrine ^2.5 shouldn't we use use Doctrine\Common\Persistence\Event\LifecycleEventArgs; by default in exemple ? Commits ------- 958df16 Updating doctrine class use
2 parents 9a28e96 + 958df16 commit 06ff68e

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)