Skip to content

Commit b4bd3ee

Browse files
Zacharias Luitenzluiten
Zacharias Luiten
authored andcommitted
Fix #4252 Cascade first before refreshing the entity itself so toMany associations are not reset to empty collections
1 parent cc566fc commit b4bd3ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Doctrine/ORM/UnitOfWork.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2166,12 +2166,12 @@ private function doRefresh($entity, array &$visited)
21662166
throw ORMInvalidArgumentException::entityNotManaged($entity);
21672167
}
21682168

2169+
$this->cascadeRefresh($entity, $visited);
2170+
21692171
$this->getEntityPersister($class->name)->refresh(
21702172
array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
21712173
$entity
21722174
);
2173-
2174-
$this->cascadeRefresh($entity, $visited);
21752175
}
21762176

21772177
/**

0 commit comments

Comments
 (0)