page metoda by mohla vratit pocet vysledkov

MKI-Miro
Člen | 278
+
0
-

Ahojte

Nebolo by mozne dorobit aby metoda

function page(int $page, int $itemsPerPage, &$numOfPages = null)

vratila okrem pocet stran aj pocet riadkov vysledku?

Dakujem

MKI-Miro
Člen | 278
+
0
-

Ahojte

tak skusim este raz

nebolo by mozne aby page metoda vyzerala takto

public function page(int $page, int $itemsPerPage, &$numOfPages = null, &$numOfRows = null)
	{
		if (func_num_args() > 2) {
			$numOfRows = $this->count('*');
			$numOfPages = (int) ceil($numOfRows / $itemsPerPage);
		}
		if ($page < 1) {
			$itemsPerPage = 0;
		}
		return $this->limit($itemsPerPage, ($page - 1) * $itemsPerPage);
	}

aktulne:

public function page(int $page, int $itemsPerPage, &$numOfPages = null)
	{
		if (func_num_args() > 2) {
			$numOfPages = (int) ceil($this->count('*') / $itemsPerPage);
		}

		if ($page < 1) {
			$itemsPerPage = 0;
		}

		return $this->limit($itemsPerPage, ($page - 1) * $itemsPerPage);
	}