1
0
mirror of synced 2025-03-04 20:03:21 +03:00

Changed GroupBy alias to real column name for all platforms and adjusted failing test accordingly. Has fallback in cases where real column name is not possible (example: Doctrine\Tests\ORM\Query\SelectSqlGenerationTest::testGroupBySupportsIdentificationVariable)

This commit is contained in:
flip111 2013-09-30 11:08:42 +02:00 committed by Philippe Lagas
parent 76fda9562c
commit 72ae7f5497
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,6 @@ namespace Doctrine\ORM\Query;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\QueryException;
@ -1625,7 +1624,9 @@ class SqlWalker implements TreeWalker
// ResultVariable
if (isset($this->queryComponents[$groupByItem]['resultVariable'])) {
if ($this->platform instanceof SQLServerPlatform) {
if ($this->queryComponents[$groupByItem]['resultVariable'] instanceof AST\PathExpression) {
return $this->walkPathExpression($this->queryComponents[$groupByItem]['resultVariable']);
} elseif (isset($this->queryComponents[$groupByItem]['resultVariable']->pathExpression)) {
return $this->walkPathExpression($this->queryComponents[$groupByItem]['resultVariable']->pathExpression);
} else {
return $this->walkResultVariable($groupByItem);

View File

@ -1573,7 +1573,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'
);
}
@ -2257,4 +2257,3 @@ class DDC1474Entity
}
}