Skip to content

Commit de1c28b

Browse files
authored
Clean the handling of proxy initialization in the UnitOfWork
Using the VarExporter Hydrator to assign default values of properties when marking an entity as initialized is needed only when using var-exporter proxies. For lazy objects, this behavior is already provided by `ReflectionClass::markLazyObjectAsInitialized`
1 parent b4ca0cd commit de1c28b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/UnitOfWork.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,9 +2383,9 @@ public function createEntity(string $className, array $data, array &$hints = [])
23832383
$class->reflClass->markLazyObjectAsInitialized($entity);
23842384
} else {
23852385
$entity->__setInitialized(true);
2386-
}
23872386

2388-
Hydrator::hydrate($entity, (array) $class->reflClass->newInstanceWithoutConstructor());
2387+
Hydrator::hydrate($entity, (array) $class->reflClass->newInstanceWithoutConstructor());
2388+
}
23892389
} else {
23902390
if (
23912391
! isset($hints[Query::HINT_REFRESH])

0 commit comments

Comments
 (0)