Skip to content

Commit

Permalink
Added \Iterator or \Generator support for slice callback return items
Browse files Browse the repository at this point in the history
  • Loading branch information
AshleyDawson authored Jan 17, 2019
1 parent de3bb0c commit b824bcb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/AshleyDawson/SimplePagination/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public function paginate($currentPageNumber = 1)
} else {
$items = $sliceCallback($offset, $this->itemsPerPage, $pagination);
}
if ($items instanceof \Iterator) {
$items = iterator_to_array($items);
}
$afterQueryCallback($this, $pagination);

$previousPageNumber = null;
Expand Down

0 comments on commit b824bcb

Please sign in to comment.