1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Merge pull request #801 from flip111/patch-4

Update SqlWalker.php fixed wrong GROUP BY clause on SQL Server platform
This commit is contained in:
Guilherme Blanco 2013-10-01 08:21:20 -07:00
commit 2c4c26c5d6
2 changed files with 11 additions and 2 deletions

View File

@ -1624,6 +1624,16 @@ class SqlWalker implements TreeWalker
// ResultVariable
if (isset($this->queryComponents[$groupByItem]['resultVariable'])) {
$resultVariable = $this->queryComponents[$groupByItem]['resultVariable'];
if ($resultVariable instanceof AST\PathExpression) {
return $this->walkPathExpression($resultVariable);
}
if (isset($resultVariable->pathExpression)) {
return $this->walkPathExpression($resultVariable->pathExpression);
}
return $this->walkResultVariable($groupByItem);
}

View File

@ -1584,7 +1584,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
{
$this->assertSqlGeneration(
'SELECT u, u.status AS st FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY st',
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3, c0_.status AS status4 FROM cms_users c0_ GROUP BY status4'
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3, c0_.status AS status4 FROM cms_users c0_ GROUP BY c0_.status'
);
}
@ -2268,4 +2268,3 @@ class DDC1474Entity
}
}