diff --git a/src/Kunstmaan/NodeBundle/EventListener/NodeTranslationListener.php b/src/Kunstmaan/NodeBundle/EventListener/NodeTranslationListener.php index 479c031d3d..25ea0687a1 100644 --- a/src/Kunstmaan/NodeBundle/EventListener/NodeTranslationListener.php +++ b/src/Kunstmaan/NodeBundle/EventListener/NodeTranslationListener.php @@ -58,7 +58,7 @@ public function prePersist(PrePersistEventArgs $args) $entity = $args->getObject(); if ($entity instanceof NodeTranslation) { - $this->setSlugWhenEmpty($entity, $args->getEntityManager()); + $this->setSlugWhenEmpty($entity, $args->getObjectManager()); $this->ensureSlugIsSlugified($entity); } } @@ -68,7 +68,7 @@ public function preUpdate(PreUpdateEventArgs $args) $entity = $args->getObject(); if ($entity instanceof NodeTranslation) { - $this->setSlugWhenEmpty($entity, $args->getEntityManager()); + $this->setSlugWhenEmpty($entity, $args->getObjectManager()); $this->ensureSlugIsSlugified($entity); } } diff --git a/src/Kunstmaan/NodeSearchBundle/EventListener/NodeIndexUpdateEventListener.php b/src/Kunstmaan/NodeSearchBundle/EventListener/NodeIndexUpdateEventListener.php index 141d485739..a74c506140 100644 --- a/src/Kunstmaan/NodeSearchBundle/EventListener/NodeIndexUpdateEventListener.php +++ b/src/Kunstmaan/NodeSearchBundle/EventListener/NodeIndexUpdateEventListener.php @@ -3,12 +3,11 @@ namespace Kunstmaan\NodeSearchBundle\EventListener; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PreUpdateEventArgs; use Kunstmaan\NodeBundle\Entity\NodeTranslation; use Kunstmaan\NodeBundle\Entity\StructureNode; use Kunstmaan\NodeBundle\Event\NodeEvent; use Kunstmaan\NodeSearchBundle\Configuration\NodePagesConfiguration; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * EventListener which will be triggered when a Node has been updated in order to update its related documents @@ -16,9 +15,6 @@ */ class NodeIndexUpdateEventListener implements NodeIndexUpdateEventListenerInterface { - /** @var ContainerInterface */ - private $container; - /** @var EntityManagerInterface */ private $em; @@ -34,13 +30,13 @@ public function __construct(NodePagesConfiguration $nodePagesConfiguration, ?Ent $this->em = $em; } - public function preUpdate(LifecycleEventArgs $args) + public function preUpdate(PreUpdateEventArgs $args) { if ($args->getObject() instanceof NodeTranslation) { // unfortunately we have to keep a state to see what has changed $this->entityChangeSet = [ 'nodeTranslationId' => $args->getObject()->getId(), - 'changeSet' => $args->getEntityManager()->getUnitOfWork()->getEntityChangeSet($args->getObject()), + 'changeSet' => $args->getObjectManager()->getUnitOfWork()->getEntityChangeSet($args->getObject()), ]; } } diff --git a/src/Kunstmaan/TaggingBundle/EventListener/TagsListener.php b/src/Kunstmaan/TaggingBundle/EventListener/TagsListener.php index 3ab583d626..8e4209cbfd 100644 --- a/src/Kunstmaan/TaggingBundle/EventListener/TagsListener.php +++ b/src/Kunstmaan/TaggingBundle/EventListener/TagsListener.php @@ -2,7 +2,9 @@ namespace Kunstmaan\TaggingBundle\EventListener; -use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Event\PostLoadEventArgs; +use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use DoctrineExtensions\Taggable\Taggable; use Kunstmaan\NodeBundle\Event\NodeEvent; use Kunstmaan\PagePartBundle\Event\PagePartEvent; @@ -28,9 +30,9 @@ public function getTagManager() return $this->tagManager; } - public function postLoad(LifecycleEventArgs $args) + public function postLoad(PostLoadEventArgs $args) { - $entity = $args->getEntity(); + $entity = $args->getObject(); if ($entity instanceof Taggable) { $this->getTagManager()->loadTagging($entity); @@ -40,9 +42,9 @@ public function postLoad(LifecycleEventArgs $args) /** * Runs the postPersist doctrine event and updates the current flag if needed */ - public function postPersist(LifecycleEventArgs $args) + public function postPersist(PostPersistEventArgs $args) { - $entity = $args->getEntity(); + $entity = $args->getObject(); if ($entity instanceof Taggable) { $this->getTagManager()->saveTagging($entity); @@ -52,7 +54,7 @@ public function postPersist(LifecycleEventArgs $args) /** * Runs the postUpdate doctrine event and updates the current flag if needed */ - public function postUpdate(LifecycleEventArgs $args) + public function postUpdate(PostUpdateEventArgs $args) { $this->postPersist($args); }