diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index 4c2fac1eb..99b4fa77d 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -1,7 +1,5 @@ * @author Jonathan Wage + * @author Benjamin Eberlei */ class DatabaseDriver implements Driver { @@ -83,13 +81,11 @@ class DatabaseDriver implements Driver $ids = array(); $fieldMappings = array(); foreach ($columns as $column) { - if (in_array($column->getName(), $allForeignKeyColumns)) { - continue; - } - $fieldMapping = array(); if (isset($indexes['primary']) && in_array($column->getName(), $indexes['primary']->getColumns())) { $fieldMapping['id'] = true; + } else if (in_array($column->getName(), $allForeignKeyColumns)) { + continue; } $fieldMapping['fieldName'] = Inflector::camelize(strtolower($column->getName()));