As i did some debuging yesterday i'll post results:
debug_print_backtace(); done at Doctrine_query::_buildSqlFromPart()
#0 Doctrine_Query->_buildSqlFromPart() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:1233]
#1 Doctrine_Query->getSqlQuery() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:1959]
#2 Doctrine_Query->getCountQuery() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:2055]
#3 Doctrine_Query->count(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Pager.php:109]
#4 Doctrine_Pager->_initialize(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Pager.php:571]
#5 Doctrine_Pager->execute() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/test.php:23]
#0 Doctrine_Query->_buildSqlFromPart(1) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:1973]
#1 Doctrine_Query->getCountQuery() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:2055]
#2 Doctrine_Query->count(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Pager.php:109]
#3 Doctrine_Pager->_initialize(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Pager.php:571]
#4 Doctrine_Pager->execute() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/test.php:23]
#0 Doctrine_Query->_buildSqlFromPart() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query.php:1233]
#1 Doctrine_Query->getSqlQuery(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query/Abstract.php:1076]
#2 Doctrine_Query_Abstract->_execute(Array ()) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Query/Abstract.php:1142]
#3 Doctrine_Query_Abstract->execute(Array (), ) called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/lib/Doctrine/Pager.php:574]
#4 Doctrine_Pager->execute() called at [/home/iff/Desktop/Doctrine-1.1.3-Sandbox/test.php:23]
That lead me to following interesting parts in the code.
Doctrine_Query.php line 1959
public function getCountQuery()
{
$this->getSqlQuery();
Doctrine_Query.php line 1126
protected function _processPendingJoinConditions($alias)
{
$parts = array();
if ($alias !== null && isset($this->_pendingJoinConditions[$alias])) {
$parser = new Doctrine_Query_JoinCondition($this, $this->_tokenizer);
foreach ($this->_pendingJoinConditions[$alias] as $joinCondition) {
$parts[] = $parser->parse($joinCondition);
}
}
Doctrine_Query.php line 1033
protected function _buildSqlFromPart($ignorePending = false)
So the problem should be obvious now. But what is the solution? Adding bunch of $ignorePending parameters to functions or object properties, so that pager can set it, when it executes does not seem right.
What version of 1.1 are you using?