ZF2 MySQL TableGateway - Total Rows Count
public function getDbRows() {
$result = $this->fetchAll(function (Select $select) {
$select->quantifier(new Expression('SQL_CALC_FOUND_ROWS'));
});
$statement = $this->getAdapter()->query('SELECT FOUND_ROWS() as total');
$resultCount = $statement->execute();
$row = $resultCount->current();
$total = $row['total'];
return [
'result' => $result,
'total' => $total
];
}