Skip to content

Commit e2079f9

Browse files
committed
Refactorings
1 parent 14bb33a commit e2079f9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/UnitOfWork.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -3039,10 +3039,12 @@ public function initializeObject(object $obj): void
30393039

30403040
if ($obj instanceof PersistentCollection) {
30413041
$obj->initialize();
3042+
3043+
return;
30423044
}
30433045

30443046
if ($this->em->getConfiguration()->isLazyProxyEnabled()) {
3045-
$reflection = new ReflectionObject($obj);
3047+
$reflection = $this->em->getClassMetadata($obj::class)->getReflectionClass();
30463048
$reflection->initializeLazyObject($obj);
30473049
}
30483050
}

tests/Tests/ORM/Functional/ReferenceProxyTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ public function testInitializeProxyOnGettingSomethingOtherThanTheIdentifier(): v
241241
#[Group('DDC-1604')]
242242
public function testCommonPersistenceProxy(): void
243243
{
244+
if ($this->_em->getConfiguration()->isLazyProxyEnabled()) {
245+
self::markTestSkipped('Test only works with proxy generation disabled.');
246+
}
247+
244248
$id = $this->createProduct();
245249

246250
$entity = $this->_em->getReference(ECommerceProduct::class, $id);

0 commit comments

Comments
 (0)