1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Implemented auto-inference of isCascadeRemove when orphanRemoval is defined (marked as todo).

This commit is contained in:
Guilherme Blanco 2011-05-14 00:43:33 -03:00
parent 08f2af489e
commit 551247d11a

View File

@ -909,9 +909,13 @@ class ClassMetadataInfo implements ClassMetadata
$mapping['targetToSourceKeyColumns'] = array_flip($mapping['sourceToTargetKeyColumns']);
}
//TODO: if orphanRemoval, cascade=remove is implicit!
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
(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']) {
throw MappingException::illegalInverseIdentifierAssocation($this->name, $mapping['fieldName']);
@ -936,10 +940,14 @@ class ClassMetadataInfo implements ClassMetadata
throw MappingException::oneToManyRequiresMappedBy($mapping['fieldName']);
}
//TODO: if orphanRemoval, cascade=remove is implicit!
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ?
(bool) $mapping['orphanRemoval'] : false;
// if orphanRemoval, cascade=remove is implicit
if ($mapping['orphanRemoval']) {
$mapping['isCascadeRemove'] = true;
}
if (isset($mapping['orderBy'])) {
if ( ! is_array($mapping['orderBy'])) {
throw new \InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));