[DDC-2775] Bugfix
This commit is contained in:
parent
8bd54be4ec
commit
e018bb83f0
@ -2230,6 +2230,10 @@ class UnitOfWork implements PropertyChangedListener
|
||||
function ($assoc) { return $assoc['isCascadeRemove']; }
|
||||
);
|
||||
|
||||
$entitiesToCascade = array();
|
||||
|
||||
// We need to load all related entities beforehand so that lazy collection loading doesn't
|
||||
// reload entities after they have been removed (bug DDC-2775)
|
||||
foreach ($associationMappings as $assoc) {
|
||||
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
|
||||
$entity->__load();
|
||||
@ -2242,18 +2246,22 @@ class UnitOfWork implements PropertyChangedListener
|
||||
case (is_array($relatedEntities)):
|
||||
// If its a PersistentCollection initialization is intended! No unwrap!
|
||||
foreach ($relatedEntities as $relatedEntity) {
|
||||
$this->doRemove($relatedEntity, $visited);
|
||||
$entitiesToCascade[] = $relatedEntity;
|
||||
}
|
||||
break;
|
||||
|
||||
case ($relatedEntities !== null):
|
||||
$this->doRemove($relatedEntities, $visited);
|
||||
$entitiesToCascade[] = $relatedEntities;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($entitiesToCascade as $relatedEntity) {
|
||||
$this->doRemove($relatedEntity, $visited);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user