Commit 3b9fd15d authored by beberlei's avatar beberlei

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

parent 5930a7c4
......@@ -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'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment