From b4d2c5ecbb8eea4f8d693a4c0503ca9b0c3ee1bc Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 17 Sep 2014 11:29:58 +0200 Subject: [PATCH] Fixed retrieving total record count --- src/Dao/Services/AbstractSearchService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Dao/Services/AbstractSearchService.php b/src/Dao/Services/AbstractSearchService.php index e03264fc..795552c1 100644 --- a/src/Dao/Services/AbstractSearchService.php +++ b/src/Dao/Services/AbstractSearchService.php @@ -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); }