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:
parent
76fda9562c
commit
72ae7f5497
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user