Skip to content

Commit

Permalink
Update ElasticquentResultCollection.php (elasticquent#76)
Browse files Browse the repository at this point in the history
Bypass slicing items object and allow Paginator instance to handle directly
  • Loading branch information
cambricorp authored and timgws committed May 6, 2016
1 parent c625b90 commit 72131f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ElasticquentResultCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ public function getAggregations()
public function paginate($pageLimit = 25)
{
$page = Paginator::resolveCurrentPage() ?: 1;
$sliced_items = array_slice($this->items, ($page - 1) * $pageLimit, $pageLimit);

return new Paginator($sliced_items, $this->hits, $this->totalHits(), $pageLimit, $page, ['path' => Paginator::resolveCurrentPath()]);

return new Paginator($this->items, $this->hits, $this->totalHits(), $pageLimit, $page, ['path' => Paginator::resolveCurrentPath()]);
}
}

0 comments on commit 72131f2

Please sign in to comment.