ObjectList: Register columns to select even if we're only counting

We should never apply any pseudo optimizations on a higher level if
already the lower level applies them, as the optimization might not
be valid in every circumstance.

fixes #9573
This commit is contained in:
Johannes Meyer 2015-07-07 15:50:40 +02:00
parent f5089dab1a
commit fc8b51c4be
1 changed files with 7 additions and 2 deletions

View File

@ -124,9 +124,14 @@ abstract class ObjectList implements Countable, IteratorAggregate, Filterable
public function count()
{
if ($this->count === null) {
$this->count = (int) $this->backend->select()->from($this->dataViewName)->applyFilter($this->filter)
->getQuery()->count();
$this->count = (int) $this->backend
->select()
->from($this->dataViewName, $this->columns)
->applyFilter($this->filter)
->getQuery()
->count();
}
return $this->count;
}