From 3eff8b0b585bfc891fa1a8eb8aae2e77fe483ca2 Mon Sep 17 00:00:00 2001 From: Bibi Date: Thu, 10 Aug 2023 14:55:46 +0200 Subject: [PATCH] Update DoctrineORMAdapter.php (#1395) Replace the getEntityManager function with the getObjectManager function. --- src/Adapter/ORM/DoctrineORMAdapter.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Adapter/ORM/DoctrineORMAdapter.php b/src/Adapter/ORM/DoctrineORMAdapter.php index fb4555c4..1de12a99 100644 --- a/src/Adapter/ORM/DoctrineORMAdapter.php +++ b/src/Adapter/ORM/DoctrineORMAdapter.php @@ -2,8 +2,7 @@ namespace Vich\UploaderBundle\Adapter\ORM; -use Doctrine\ORM\Event\LifecycleEventArgs; -use Doctrine\Persistence\Event\LifecycleEventArgs as BaseLifecycleEventArgs; +use Doctrine\Persistence\Event\LifecycleEventArgs; use Vich\UploaderBundle\Adapter\AdapterInterface; /** @@ -15,14 +14,11 @@ */ final class DoctrineORMAdapter implements AdapterInterface { - /** - * @param LifecycleEventArgs $event - */ - public function recomputeChangeSet(BaseLifecycleEventArgs $event): void + public function recomputeChangeSet(LifecycleEventArgs $event): void { $object = $event->getObject(); - - $em = $event->getEntityManager(); + /** @var \Doctrine\ORM\EntityManagerInterface $em */ + $em = $event->getObjectManager(); $uow = $em->getUnitOfWork(); $metadata = $em->getClassMetadata($object::class); $uow->recomputeSingleEntityChangeSet($metadata, $object);