refactoring: extract method
This commit is contained in:
parent
a81458a0aa
commit
511b27517a
@ -1679,11 +1679,7 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
|
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
|
||||||
$mapping['isCascadeRemove'] = $mapping['orphanRemoval'] ? true : $mapping['isCascadeRemove'];
|
$mapping['isCascadeRemove'] = $mapping['orphanRemoval'] ? true : $mapping['isCascadeRemove'];
|
||||||
|
|
||||||
if (isset($mapping['orderBy'])) {
|
$this->assertMappingOrderBy($mapping);
|
||||||
if ( ! is_array($mapping['orderBy'])) {
|
|
||||||
throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $mapping;
|
return $mapping;
|
||||||
}
|
}
|
||||||
@ -1789,11 +1785,7 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
|
|
||||||
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
|
$mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;
|
||||||
|
|
||||||
if (isset($mapping['orderBy'])) {
|
$this->assertMappingOrderBy($mapping);
|
||||||
if ( ! is_array($mapping['orderBy'])) {
|
|
||||||
throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $mapping;
|
return $mapping;
|
||||||
}
|
}
|
||||||
@ -3388,4 +3380,14 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
|
|
||||||
return $sequencePrefix;
|
return $sequencePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $mapping
|
||||||
|
*/
|
||||||
|
private function assertMappingOrderBy(array $mapping)
|
||||||
|
{
|
||||||
|
if (isset($mapping['orderBy']) && !is_array($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