Implemented auto-inference of isCascadeRemove when orphanRemoval is defined (marked as todo).
This commit is contained in:
parent
08f2af489e
commit
551247d11a
@ -909,10 +909,14 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
$mapping['targetToSourceKeyColumns'] = array_flip($mapping['sourceToTargetKeyColumns']);
|
$mapping['targetToSourceKeyColumns'] = array_flip($mapping['sourceToTargetKeyColumns']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: if orphanRemoval, cascade=remove is implicit!
|
|
||||||
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
|
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
|
||||||
(bool) $mapping['orphanRemoval'] : false;
|
(bool) $mapping['orphanRemoval'] : false;
|
||||||
|
|
||||||
|
// if orphanRemoval, cascade=remove is implicit
|
||||||
|
if ($mapping['orphanRemoval']) {
|
||||||
|
$mapping['isCascadeRemove'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) {
|
if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) {
|
||||||
throw MappingException::illegalInverseIdentifierAssocation($this->name, $mapping['fieldName']);
|
throw MappingException::illegalInverseIdentifierAssocation($this->name, $mapping['fieldName']);
|
||||||
}
|
}
|
||||||
@ -936,10 +940,14 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
|
throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: if orphanRemoval, cascade=remove is implicit!
|
|
||||||
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
|
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
|
||||||
(bool) $mapping['orphanRemoval'] : false;
|
(bool) $mapping['orphanRemoval'] : false;
|
||||||
|
|
||||||
|
// if orphanRemoval, cascade=remove is implicit
|
||||||
|
if ($mapping['orphanRemoval']) {
|
||||||
|
$mapping['isCascadeRemove'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($mapping['orderBy'])) {
|
if (isset($mapping['orderBy'])) {
|
||||||
if ( ! is_array($mapping['orderBy'])) {
|
if ( ! is_array($mapping['orderBy'])) {
|
||||||
throw new \InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
|
throw new \InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user