From dc190a297daaeb3e36b034eebdbf4154584b35c3 Mon Sep 17 00:00:00 2001 From: aleks Date: Sun, 27 Jan 2013 11:09:26 +0200 Subject: [PATCH] Fix typo --- .../ORM/Tools/Pagination/LimitSubqueryOutputWalker.php | 10 ++++------ .../Tools/Pagination/LimitSubqueryOutputWalkerTest.php | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php index 02eaeeaa5..3943cb5e6 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php @@ -179,16 +179,14 @@ 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) { $sqlOrderColumns[] = $alias; - $orderBy[] = $alias . ' ' . $item->type; + $orderBy[] = $alias . ' ' . $item->type; break; } } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php index 6d8355525..bb69cd310 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php @@ -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');