diff --git a/src/UnitOfWork.php b/src/UnitOfWork.php index 2969a3e0e0f..0f775910d83 100644 --- a/src/UnitOfWork.php +++ b/src/UnitOfWork.php @@ -2473,13 +2473,13 @@ private function doRefresh($entity, array &$visited, ?int $lockMode = null): voi throw ORMInvalidArgumentException::entityNotManaged($entity); } + $this->cascadeRefresh($entity, $visited, $lockMode); + $this->getEntityPersister($class->name)->refresh( array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]), $entity, $lockMode ); - - $this->cascadeRefresh($entity, $visited, $lockMode); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/LazyEagerCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/LazyEagerCollectionTest.php index 2797dfd67bb..926e0523153 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/LazyEagerCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/LazyEagerCollectionTest.php @@ -17,6 +17,7 @@ class LazyEagerCollectionTest extends OrmFunctionalTestCase protected function setUp(): void { parent::setUp(); + $this->createSchemaForModels( LazyEagerCollectionUser::class, LazyEagerCollectionAddress::class,