Fixed negative offsets in AbstractDao

This commit is contained in:
Marcin Kurczewski 2014-09-30 14:50:58 +02:00
parent 31e0158606
commit 6f563e72c3

View file

@ -81,7 +81,7 @@ abstract class AbstractDao implements ICrudDao
if ($searchFilter->getPageSize() > 0)
{
$query->limit($searchFilter->getPageSize());
$query->offset($searchFilter->getPageSize() * ($searchFilter->getPageNumber() - 1));
$query->offset($searchFilter->getPageSize() * max(0, $searchFilter->getPageNumber() - 1));
}
$entities = $this->arrayToEntities(iterator_to_array($query));