add limit and offset for apicontroller

This commit is contained in:
2023-11-21 09:19:57 +01:00
parent c185c35c44
commit 502894ecea
2 changed files with 16 additions and 3 deletions

View File

@@ -80,9 +80,19 @@ class NewsItemRepository implements ObjectRepository
return $qb->getQuery()->getResult();
}
public function findWithDateFilter()
public function findWithDateFilter($limit = null, $offset = null)
{
return $this->buildQueryWithDateFilter()
$qb = $this->buildQueryWithDateFilter();
if ($limit) {
$qb->setMaxResults($limit);
}
if ($offset) {
$qb->setFirstResult($offset);
}
return $qb
->getQuery()
->getResult();
}