Merge branch 'ValidateJoinColumnsMatching'
This commit is contained in:
commit
75e1d17d18
@ -152,6 +152,17 @@ class SchemaValidator
|
|||||||
"has to be a primary key column.";
|
"has to be a primary key column.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($targetClass->identifier) != count($assoc['joinTable']['inverseJoinColumns'])) {
|
||||||
|
$ce[] = "The inverse join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " .
|
||||||
|
"have to match to ALL identifier columns of the target entity '". $targetClass->name . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($class->identifier) != count($assoc['joinTable']['joinColumns'])) {
|
||||||
|
$ce[] = "The join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " .
|
||||||
|
"have to match to ALL identifier columns of the source entity '". $class->name . "'";
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($assoc['type'] & ClassMetadataInfo::TO_ONE) {
|
} else if ($assoc['type'] & ClassMetadataInfo::TO_ONE) {
|
||||||
foreach ($assoc['joinColumns'] AS $joinColumn) {
|
foreach ($assoc['joinColumns'] AS $joinColumn) {
|
||||||
$targetClass = $cmf->getMetadataFor($assoc['targetEntity']);
|
$targetClass = $cmf->getMetadataFor($assoc['targetEntity']);
|
||||||
@ -167,6 +178,11 @@ class SchemaValidator
|
|||||||
"has to be a primary key column.";
|
"has to be a primary key column.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($class->identifier) != count($assoc['joinColumns'])) {
|
||||||
|
$ce[] = "The join columns of the association '" . $assoc['fieldName'] . "' " .
|
||||||
|
"have to match to ALL identifier columns of the source entity '". $class->name . "'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user