The FindAll method was returning on the wrong results when using pagination.
The $pageNumber argument was being passed directly to the query as the startPosition instead of determining what the startPosition should be based on the $pageNumber and $pageSize.
This PR determines the correct startPosition for the query.
The $pageNumber argument default has been updated to 1 since that makes more sense. When thinking about pages we think of them as starting at 1 not 0.
Example
Say you had 25 items and were wanting to return them all in pages of 10.
The
FindAll
method was returning on the wrong results when using pagination.The
$pageNumber
argument was being passed directly to the query as thestartPosition
instead of determining what thestartPosition
should be based on the$pageNumber
and$pageSize
.This PR determines the correct
startPosition
for the query.The
$pageNumber
argument default has been updated to1
since that makes more sense. When thinking about pages we think of them as starting at 1 not 0.Example
Say you had 25 items and were wanting to return them all in pages of 10.
Page 0
Result:
Expected:
(this is redundant and the same as page 1)
Page 1
Result:
Expected:
Page 2
Result:
Expected:
Page 3
Result:
Expected: