Browse files

Merge pull request #688 from sellingsource/master

Implement QuoteStrategy on SqlWalker walkRangeVariableDeclaration
  • Loading branch information...
2 parents 0a90279 + 4ef043f commit 6ef48561baa6cd6e3da1304d7d815883be9a9af1 @guilhermeblanco guilhermeblanco committed Jun 12, 2013
Showing with 15 additions and 4 deletions.
  1. +4 −4 lib/Doctrine/ORM/Query/SqlWalker.php
  2. +11 −0 tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
View
8 lib/Doctrine/ORM/Query/SqlWalker.php
@@ -844,8 +844,8 @@ public function walkRangeVariableDeclaration($rangeVariableDeclaration)
$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 @@ public function walkJoinAssociationDeclaration($joinAssociationDeclaration, $joi
$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 @@ public function walkJoinAssociationDeclaration($joinAssociationDeclaration, $joi
// 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'])
View
11 tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
@@ -1846,6 +1846,17 @@ public function testColumnNameWithNumbersAndNonAlphanumericCharacters()
);
}
+ /**
+ * @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
*/

0 comments on commit 6ef4856

Please sign in to comment.