diff --git a/src/Repository/EventRepository.php b/src/Repository/EventRepository.php index 9e568e4..3767c67 100644 --- a/src/Repository/EventRepository.php +++ b/src/Repository/EventRepository.php @@ -52,11 +52,11 @@ class EventRepository yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations); } - public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator + public function getPagedByCommunity(Community $community, int $page, int $itemsPerPage, bool $useRelations = false, array $withRelations = []): Generator { $select = $this->selectAllByCommunity($community); $select->orderBy('start', 'DESC'); - $select->limit($limit, $start); + $select->paginate($page, $itemsPerPage); yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations); } diff --git a/src/Repository/TransactionRepository.php b/src/Repository/TransactionRepository.php index 8d2c5b0..66057dd 100644 --- a/src/Repository/TransactionRepository.php +++ b/src/Repository/TransactionRepository.php @@ -66,20 +66,20 @@ class TransactionRepository return $select->count() > 0; } - public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator + public function getPagedByCommunity(Community $community, int $page, int $itemsPerPage, bool $useRelations = false, array $withRelations = []): Generator { $select = $this->selectAllByCommunity($community); $select->orderBy('time', 'DESC'); - $select->limit($limit, $start); + $select->paginate($page, $itemsPerPage); yield from Container::$persistentDataManager->selectMultipleFromDb($select, Transaction::class, $useRelations, $withRelations); } - public function getPagedByEvent(Event $event, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator + public function getPagedByEvent(Event $event, int $page, int $itemsPerPage, bool $useRelations = false, array $withRelations = []): Generator { $select = $this->selectAllByEvent($event); $select->orderBy('time', 'DESC'); - $select->limit($limit, $start); + $select->paginate($page, $itemsPerPage); yield from Container::$persistentDataManager->selectMultipleFromDb($select, Transaction::class, $useRelations, $withRelations); }