1
0
mirror of synced 2025-01-22 08:11:40 +03:00
This commit is contained in:
aleks 2013-01-27 11:09:26 +02:00
parent 6662096ed3
commit dc190a297d
2 changed files with 5 additions and 7 deletions

View File

@ -179,11 +179,9 @@ class LimitSubqueryOutputWalker extends SqlWalker
$orderBy = array();
if (isset($AST->orderByClause)) {
foreach ($AST->orderByClause->orderByItems as $item) {
if (is_object($item->expression)) {
$possibleAliases = array_keys($this->rsm->fieldMappings, $item->expression->field);
} else {
$possibleAliases = array_keys($this->rsm->scalarMappings, $item->expression);
}
$possibleAliases = (is_object($item->expression))
? array_keys($this->rsm->fieldMappings, $item->expression->field)
: array_keys($this->rsm->scalarMappings, $item->expression);
foreach ($possibleAliases as $alias) {
if (!is_object($item->expression) || $this->rsm->columnOwnerMap[$alias] == $item->expression->identificationVariable) {

View File

@ -42,7 +42,7 @@ class LimitSubqueryOutputWalkerTest extends PaginationTestCase
$this->entityManager->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\PostgreSqlPlatform);
$query = $this->entityManager->createQuery(
'SELECT u, g, COUNT(g.id) AS g_quantity FROM Doctrine\Tests\ORM\Tools\Pagination\USER u JOIN u.groups g ORDER BY g_quantity'
'SELECT u, g, COUNT(g.id) AS g_quantity FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g ORDER BY g_quantity'
);
$limitQuery = clone $query;
$limitQuery->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker');