From e7732ee975ed968ee40ed219833955cfcd26e8c4 Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 31 May 2007 18:30:47 +0000 Subject: [PATCH] DQL limit-subquery-algorithm ORDER BY handling fixed --- lib/Doctrine/Query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index b9f21d5f9..3e373384b 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -751,14 +751,14 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $subquery .= ' FROM'; + foreach ($this->parts['from'] as $part) { // preserve LEFT JOINs only if needed if (substr($part, 0, 9) === 'LEFT JOIN') { $e = explode(' ', $part); - - if ( ! in_array($e[3], $this->subqueryAliases) && - ! in_array($e[2], $this->subqueryAliases)) { - continue; + + if (empty($this->parts['orderby']) && empty($this->parts['where'])) { + continue; } }