diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 082f95f50..c3fb467de 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -21,6 +21,7 @@ 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; @@ -1624,7 +1625,11 @@ class SqlWalker implements TreeWalker // ResultVariable if (isset($this->queryComponents[$groupByItem]['resultVariable'])) { - return $this->walkResultVariable($groupByItem); + if ($this->platform instanceof SQLServerPlatform) { + return $this->walkPathExpression($this->queryComponents[$groupByItem]['resultVariable']->pathExpression); + } else { + return $this->walkResultVariable($groupByItem); + } } // IdentificationVariable