Skip to content

Commit 72131f2

Browse files
cambricorptimgws
authored andcommitted
Update ElasticquentResultCollection.php (#76)
Bypass slicing items object and allow Paginator instance to handle directly
1 parent c625b90 commit 72131f2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/ElasticquentResultCollection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ public function getAggregations()
142142
public function paginate($pageLimit = 25)
143143
{
144144
$page = Paginator::resolveCurrentPage() ?: 1;
145-
$sliced_items = array_slice($this->items, ($page - 1) * $pageLimit, $pageLimit);
146-
147-
return new Paginator($sliced_items, $this->hits, $this->totalHits(), $pageLimit, $page, ['path' => Paginator::resolveCurrentPath()]);
145+
146+
return new Paginator($this->items, $this->hits, $this->totalHits(), $pageLimit, $page, ['path' => Paginator::resolveCurrentPath()]);
148147
}
149148
}

0 commit comments

Comments
 (0)