diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index ffeb15859..b52c584a4 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -617,9 +617,10 @@ class SchemaTool $associationTables = $this->_getAssociationTables($commitOrder); // Drop association tables first - foreach ($associationTables as $associationTable) { - if (!in_array($associationTable, $orderedTables)) { - $orderedTables[] = $associationTable; + foreach ($associationTables as $quotedAssociationTableName) { + // avoid adding duplicates + if (!in_array($quotedAssociationTableName, $orderedTables)) { + $orderedTables[] = $quotedAssociationTableName; } } @@ -633,7 +634,7 @@ class SchemaTool } if (!in_array($class->getTableName(), $orderedTables)) { - $orderedTables[] = $class->getTableName(); + $orderedTables[] = $class->getQuotedTableName($this->_platform); } } @@ -731,9 +732,10 @@ class SchemaTool $associationTables = array(); foreach ($classes as $class) { + /* @var $class \Doctrine\ORM\Mapping\ClassMetadata */ foreach ($class->associationMappings as $assoc) { if ($assoc['isOwningSide'] && $assoc['type'] == ClassMetadata::MANY_TO_MANY) { - $associationTables[] = $assoc['joinTable']['name']; + $associationTables[] = $class->getQuotedJoinTableName($assoc, $this->_platform); } } }