Fixed retrieving total record count

This commit is contained in:
Marcin Kurczewski 2014-09-17 11:29:58 +02:00
parent 932407a571
commit b4d2c5ecbb

View file

@ -52,7 +52,9 @@ abstract class AbstractSearchService
foreach ($query as $arrayEntity)
$entities[] = $this->entityConverter->toEntity($arrayEntity);
$query->select('COUNT(1) AS c');
$query = $this->fpdo
->from($this->tableName)
->select('COUNT(1) AS c');
$totalRecords = intval(iterator_to_array($query)[0]['c']);
return new \Szurubooru\Dao\SearchResult($searchFilter, $entities, $totalRecords);
}