[DDC-1667] Removed implicit obligation to define an Index and UniqueConstraint name. It is optional, but Annotations Driver was broken if not defined.
This commit is contained in:
parent
1447884fde
commit
a47e566382
@ -176,17 +176,25 @@ class AnnotationDriver implements Driver
|
|||||||
|
|
||||||
if ($tableAnnot->indexes !== null) {
|
if ($tableAnnot->indexes !== null) {
|
||||||
foreach ($tableAnnot->indexes as $indexAnnot) {
|
foreach ($tableAnnot->indexes as $indexAnnot) {
|
||||||
$primaryTable['indexes'][$indexAnnot->name] = array(
|
$index = array('columns' => $indexAnnot->columns);
|
||||||
'columns' => $indexAnnot->columns
|
|
||||||
);
|
if ( ! empty($indexAnnot->name)) {
|
||||||
|
$primaryTable['indexes'][$indexAnnot->name] = $index;
|
||||||
|
} else {
|
||||||
|
$primaryTable['indexes'][] = $index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tableAnnot->uniqueConstraints !== null) {
|
if ($tableAnnot->uniqueConstraints !== null) {
|
||||||
foreach ($tableAnnot->uniqueConstraints as $uniqueConstraint) {
|
foreach ($tableAnnot->uniqueConstraints as $uniqueConstraintAnnot) {
|
||||||
$primaryTable['uniqueConstraints'][$uniqueConstraint->name] = array(
|
$uniqueConstraint = array('columns' => $uniqueConstraintAnnot->columns);
|
||||||
'columns' => $uniqueConstraint->columns
|
|
||||||
);
|
if ( ! empty($uniqueConstraintAnnot->name)) {
|
||||||
|
$primaryTable['uniqueConstraints'][$uniqueConstraintAnnot->name] = $uniqueConstraint;
|
||||||
|
} else {
|
||||||
|
$primaryTable['uniqueConstraints'][] = $uniqueConstraint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user