Skip to content

Commit

Permalink
Merge pull request #62 from moufmouf/cast_count_to_int
Browse files Browse the repository at this point in the history
Casting count() to int
  • Loading branch information
moufmouf committed Dec 18, 2017
2 parents 5441273 + 404dd75 commit d1f3b32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ResultIterator.php
Expand Up @@ -79,19 +79,19 @@ public function __construct(QueryFactory $queryFactory, array $parameters, $obje
$this->logger = $logger;
}

protected function executeCountQuery()
protected function executeCountQuery(): void
{
$sql = $this->magicQuery->build($this->queryFactory->getMagicSqlCount(), $this->parameters);
$this->logger->debug('Running count query: '.$sql);
$this->totalCount = $this->tdbmService->getConnection()->fetchColumn($sql, $this->parameters);
$this->totalCount = (int) $this->tdbmService->getConnection()->fetchColumn($sql, $this->parameters);
}

/**
* Counts found records (this is the number of records fetched, taking into account the LIMIT and OFFSET settings).
*
* @return int
*/
public function count()
public function count(): int
{
if ($this->totalCount === null) {
$this->executeCountQuery();
Expand Down

0 comments on commit d1f3b32

Please sign in to comment.