DDC-154 - Commit patch by giorgiosironi which improves SchemaTool error messages.
This commit is contained in:
parent
5930a7c42d
commit
3b9fd15dd6
1 changed files with 10 additions and 1 deletions
|
@ -326,7 +326,16 @@ class SchemaTool
|
||||||
foreach ($mapping->getJoinColumns() as $joinColumn) {
|
foreach ($mapping->getJoinColumns() as $joinColumn) {
|
||||||
$column = array();
|
$column = array();
|
||||||
$column['name'] = $mapping->getQuotedJoinColumnName($joinColumn['name'], $this->_platform);
|
$column['name'] = $mapping->getQuotedJoinColumnName($joinColumn['name'], $this->_platform);
|
||||||
$column['type'] = Type::getType($foreignClass->getTypeOfColumn($joinColumn['referencedColumnName']));
|
$referencedColumnName = $joinColumn['referencedColumnName'];
|
||||||
|
$referencedFieldName = $foreignClass->getFieldName($referencedColumnName);
|
||||||
|
if (!$foreignClass->hasField($referencedFieldName)) {
|
||||||
|
throw new \Doctrine\Common\DoctrineException(
|
||||||
|
"Column name `$referencedColumnName` referenced for relation from ".
|
||||||
|
"$mapping->sourceEntityName towards $mapping->targetEntityName does not exist."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$column['type'] = Type::getType($foreignClass->getTypeOfField($referencedFieldName));
|
||||||
|
|
||||||
$columns[$column['name']] = $column;
|
$columns[$column['name']] = $column;
|
||||||
$constraint['local'][] = $column['name'];
|
$constraint['local'][] = $column['name'];
|
||||||
$constraint['foreign'][] = $joinColumn['referencedColumnName'];
|
$constraint['foreign'][] = $joinColumn['referencedColumnName'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue