Commit 431b63d6 authored by zYne's avatar zYne

fixes #356

parent 4fb80468
...@@ -699,7 +699,9 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -699,7 +699,9 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
// parse the DQL parts // parse the DQL parts
foreach ($this->_dqlParts as $queryPartName => $queryParts) { foreach ($this->_dqlParts as $queryPartName => $queryParts) {
$this->parts[$queryPartName] = array();
$this->removeQueryPart($queryPartName);
if (is_array($queryParts) && ! empty($queryParts)) { if (is_array($queryParts) && ! empty($queryParts)) {
foreach ($queryParts as $queryPart) { foreach ($queryParts as $queryPart) {
...@@ -709,7 +711,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -709,7 +711,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$sql = $parser->parse($queryPart); $sql = $parser->parse($queryPart);
if (isset($sql)) { if (isset($sql)) {
if ($queryPartName == 'limit' || if ($queryPartName == 'limit' ||
$queryPartName == 'offset') { $queryPartName == 'offset') {
$this->setQueryPart($queryPartName, $sql); $this->setQueryPart($queryPartName, $sql);
...@@ -800,7 +802,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -800,7 +802,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$q .= ( ! empty($this->parts['having']))? ' HAVING ' . implode(' AND ', $this->parts['having']): ''; $q .= ( ! empty($this->parts['having']))? ' HAVING ' . implode(' AND ', $this->parts['having']): '';
$q .= ( ! empty($this->parts['orderby']))? ' ORDER BY ' . implode(', ', $this->parts['orderby']) : ''; $q .= ( ! empty($this->parts['orderby']))? ' ORDER BY ' . implode(', ', $this->parts['orderby']) : '';
if ($modifyLimit) { if ($modifyLimit) {
$q = $this->_conn->modifyLimitQuery($q, $this->parts['limit'], $this->parts['offset']); $q = $this->_conn->modifyLimitQuery($q, $this->parts['limit'], $this->parts['offset']);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment