diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index c048ba2c9..5eae0bf9a 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -844,8 +844,8 @@ class SqlWalker implements TreeWalker $this->rootAliases[] = $dqlAlias; - $sql = $class->getQuotedTableName($this->platform) . ' ' - . $this->getSQLTableAlias($class->getTableName(), $dqlAlias); + $sql = $this->quoteStrategy->getTableName($class,$this->platform) . ' ' + . $this->getSQLTableAlias($class->getTableName(), $dqlAlias); if ($class->isInheritanceTypeJoined()) { $sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias); @@ -875,7 +875,7 @@ class SqlWalker implements TreeWalker $relation = $this->queryComponents[$joinedDqlAlias]['relation']; $targetClass = $this->em->getClassMetadata($relation['targetEntity']); $sourceClass = $this->em->getClassMetadata($relation['sourceEntity']); - $targetTableName = $targetClass->getQuotedTableName($this->platform); + $targetTableName = $this->quoteStrategy->getTableName($targetClass,$this->platform); $targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName(), $joinedDqlAlias); $sourceTableAlias = $this->getSQLTableAlias($sourceClass->getTableName(), $associationPathExpression->identificationVariable); @@ -930,7 +930,7 @@ class SqlWalker implements TreeWalker // Join relation table $joinTable = $assoc['joinTable']; $joinTableAlias = $this->getSQLTableAlias($joinTable['name'], $joinedDqlAlias); - $joinTableName = $sourceClass->getQuotedJoinTableName($assoc, $this->platform); + $joinTableName = $this->quoteStrategy->getJoinTableName($assoc, $sourceClass, $this->platform); $conditions = array(); $relationColumns = ($relation['isOwningSide']) diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index a924ed741..785e25850 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -1846,6 +1846,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase ); } + /** + * @group DDC-1845 + */ + public function testQuotedTableDeclaration() + { + $this->assertSqlGeneration( + 'SELECT u FROM Doctrine\Tests\Models\Quote\User u', + 'SELECT q0_."user-id" AS userid0, q0_."user-name" AS username1 FROM "quote-user" q0_' + ); + } + /** * @group DDC-1845 */