//PRECONDITION: getCombinedFilter() does not return null
/** @throws PntError */
function ($rowCount=20) {
if (isSet($this->result)) return $this->result;
$size = $this->();
if ($size && !(is_numeric($size) && $size == (int) $size) )
throw new PntValidationException('All items size no integer: '. $size);
$offset = $this->();
if ($offset && !(is_numeric($offset) && $offset == (int) $offset) )
throw new PntValidationException('Page item offset no integer: '. $offset);
$filter = $this->();
$sort = $this->($filter);
$clsDes = $this->whole->();
$qh = $clsDes->();
if (!($rowCount == 'All' || $size || $qh->())) {
$tableName = $clsDes->();
$qh->query = "SELECT count(DISTINCT($tableName.id)) FROM $tableName";
if ($clsDes->polymorphismPropName)
$qh->($clsDes->(), $tableName);
$qh->($filter, false);
$this->allItemsSize = $qh->(null, 'Error counting search result');
}
$qh = $clsDes->(); //zonder SELECT .. getSimpleQueryHandler
$qh->($sort);
//print $qh->query;
if ($rowCount == 'All') {
$result = $clsDes->($qh);
$this->allItemsSize = count($result);
} elseif (is_numeric($this->())) {
$qh->($rowCount, $offset);
$result = $clsDes->($qh);
} else {
$result = $this->($qh, $rowCount);
}
$this->result = $result;
return $result;
}
|