Commit 2ab66510 authored by vstaikov's avatar vstaikov Committed by Alexander Butenko

Bring up the $totalCount in dbObject::paginate() (#788)

* Bring up the totalCount in paginate()

* Fix pagination 'processWith'
parent 610a8c21
......@@ -87,6 +87,11 @@ class dbObject {
* @var int
*/
public static $totalPages = 0;
/**
* Variable which holds an amount of returned rows during paginate queries
* @var string
*/
public static $totalCount = 0;
/**
* An array that holds insert/update/select errors
*
......@@ -472,8 +477,11 @@ class dbObject {
*/
private function paginate ($page, $fields = null) {
$this->db->pageLimit = self::$pageLimit;
$objects = Array ();
$this->processHasOneWith ();
$res = $this->db->paginate ($this->dbTable, $page, $fields);
self::$totalPages = $this->db->totalPages;
self::$totalCount = $this->db->totalCount;
if ($this->db->count == 0) return null;
foreach ($res as $k => &$r) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment