From 6f563e72c36c4f9a666b75a46b273e0601858706 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 30 Sep 2014 14:50:58 +0200 Subject: [PATCH] Fixed negative offsets in AbstractDao --- src/Dao/AbstractDao.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dao/AbstractDao.php b/src/Dao/AbstractDao.php index 85d559a8..41f41099 100644 --- a/src/Dao/AbstractDao.php +++ b/src/Dao/AbstractDao.php @@ -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));