Fix count query ignoring joins

Count queries were created before the required columns were added,
so they often returned more values than a resultset really offers

refs #4589
This commit is contained in:
Jannis Moßhammer 2013-08-29 18:47:16 +02:00 committed by Eric Lippmann
parent cce217c7c2
commit aac1d69ed2
1 changed files with 6 additions and 6 deletions

View File

@ -61,12 +61,6 @@ class Query extends AbstractQuery
protected function createQueryObjects()
{
$this->beforeCreatingCountQuery();
$this->countQuery = clone($this->baseQuery);
if ($this->countColumns === null) {
$this->countColumns = array('cnt' => 'COUNT(*)');
}
$this->countQuery->columns($this->countColumns);
$this->beforeCreatingSelectQuery();
$this->selectQuery = clone($this->baseQuery);
$this->selectQuery->columns($this->columns);
@ -79,6 +73,12 @@ class Query extends AbstractQuery
);
}
}
$this->countQuery = clone($this->baseQuery);
if ($this->countColumns === null) {
$this->countColumns = array('cnt' => 'COUNT(*)');
}
$this->countQuery->columns($this->countColumns);
}
protected function beforeCreatingCountQuery()