1
0
mirror of synced 2025-01-18 22:41:43 +03:00

DDC-154 - Commit patch by giorgiosironi which improves SchemaTool error messages.

This commit is contained in:
beberlei 2009-11-21 12:11:30 +00:00
parent 5930a7c42d
commit 3b9fd15dd6

View File

@ -326,7 +326,16 @@ class SchemaTool
foreach ($mapping->getJoinColumns() as $joinColumn) {
$column = array();
$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;
$constraint['local'][] = $column['name'];
$constraint['foreign'][] = $joinColumn['referencedColumnName'];