Move final cascade-persist-checking so that it covers not just normal flushes, but also flushes where specific entities are singled out.
This commit is contained in:
parent
17b996da8c
commit
b456cffa2d
@ -347,6 +347,8 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->assertNoCascadingGaps();
|
||||||
|
|
||||||
if ( ! ($this->entityInsertions ||
|
if ( ! ($this->entityInsertions ||
|
||||||
$this->entityDeletions ||
|
$this->entityDeletions ||
|
||||||
$this->entityUpdates ||
|
$this->entityUpdates ||
|
||||||
@ -829,16 +831,6 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter out any entities that we (successfully) managed to schedule
|
|
||||||
* for insertion.
|
|
||||||
*/
|
|
||||||
$entitiesNeedingCascadePersist = array_diff_key($this->newEntitiesWithoutCascade, $this->entityInsertions);
|
|
||||||
if(count($entitiesNeedingCascadePersist) > 0){
|
|
||||||
list($assoc,$entity) = array_values($entitiesNeedingCascadePersist)[0];
|
|
||||||
throw ORMInvalidArgumentException::newEntityFoundThroughRelationship($assoc, $entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3395,6 +3387,26 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
return $id1 === $id2 || implode(' ', $id1) === implode(' ', $id2);
|
return $id1 === $id2 || implode(' ', $id1) === implode(' ', $id2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that there are no new entities found through non-cascade-persist
|
||||||
|
* paths which are not also scheduled for insertion through valid paths.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws ORMInvalidArgumentException
|
||||||
|
*/
|
||||||
|
private function assertNoCascadingGaps()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Filter out any entities that we (successfully) managed to schedule
|
||||||
|
* for insertion.
|
||||||
|
*/
|
||||||
|
$entitiesNeedingCascadePersist = array_diff_key($this->newEntitiesWithoutCascade, $this->entityInsertions);
|
||||||
|
if(count($entitiesNeedingCascadePersist) > 0){
|
||||||
|
list($assoc,$entity) = array_values($entitiesNeedingCascadePersist)[0];
|
||||||
|
throw ORMInvalidArgumentException::newEntityFoundThroughRelationship($assoc, $entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $entity
|
* @param object $entity
|
||||||
* @param object $managedCopy
|
* @param object $managedCopy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user