Commit e03ef625 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 82da4622
...@@ -48,6 +48,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -48,6 +48,8 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
*/ */
protected $isSubquery; protected $isSubquery;
protected $isLimitSubqueryUsed = false;
protected $neededTables = array(); protected $neededTables = array();
/** /**
* @var array $pendingFields * @var array $pendingFields
...@@ -128,6 +130,15 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -128,6 +130,15 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
{ {
return $this->_enumParams; return $this->_enumParams;
} }
/**
* limitSubqueryUsed
*
* @return boolean
*/
public function isLimitSubqueryUsed()
{
return $this->isLimitSubqueryUsed;
}
/** /**
* convertEnums * convertEnums
* convert enum parameters to their integer equivalents * convert enum parameters to their integer equivalents
...@@ -564,6 +575,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -564,6 +575,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$rootAlias = key($this->_aliasMap); $rootAlias = key($this->_aliasMap);
if ( ! empty($this->parts['limit']) && $this->needsSubquery && $table->getAttribute(Doctrine::ATTR_QUERY_LIMIT) == Doctrine::LIMIT_RECORDS) { if ( ! empty($this->parts['limit']) && $this->needsSubquery && $table->getAttribute(Doctrine::ATTR_QUERY_LIMIT) == Doctrine::LIMIT_RECORDS) {
$this->isLimitSubqueryUsed = true;
$needsSubQuery = true; $needsSubQuery = true;
} }
...@@ -702,7 +714,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -702,7 +714,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
continue; continue;
} }
if($this->aliasHandler->hasAliasFor($part)) { if($this->aliasHandler->hasAlias($part)) {
$parts[$k] = $this->aliasHandler->generateNewAlias($part); $parts[$k] = $this->aliasHandler->generateNewAlias($part);
} }
...@@ -896,6 +908,11 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable ...@@ -896,6 +908,11 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable
$componentAlias = $prevPath; $componentAlias = $prevPath;
} }
// if the current alias already exists, skip it
if (isset($this->_aliasMap[$componentAlias])) {
continue;
}
if ( ! isset($table)) { if ( ! isset($table)) {
// process the root of the path // process the root of the path
......
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