Skip to content

Commit ba845a1

Browse files
authored
Merge pull request #64 from hcarsten/master
Changes to allow limit / page as "not given"
2 parents 4120770 + 05a0b7b commit ba845a1

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/Data/Criteria.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ class Criteria implements ParseAware
3535
*/
3636
public const TOTAL_COUNT_MODE_NEXT_PAGES = 2;
3737

38-
private int $page;
3938

40-
private ?int $limit;
39+
/**
40+
* page and limit should be mixed to allow null also
41+
* this would prevent from generating pagination problems
42+
*
43+
* @var mixed
44+
*/
45+
private $page;
46+
47+
/**
48+
* see above
49+
* @var mixed
50+
*/
51+
private $limit;
4152

4253
/**
4354
* Don't use term parameters together with query parameters.
@@ -84,7 +95,13 @@ class Criteria implements ParseAware
8495

8596
private array $includes = [];
8697

87-
public function __construct(int $page = 1, ?int $limit = 25)
98+
/**
99+
* Default should be null to not limit artificily
100+
*
101+
* @param $page
102+
* @param $limit
103+
*/
104+
public function __construct($page = null, $limit = null)
88105
{
89106
$this->page = $page;
90107
$this->limit = $limit;

0 commit comments

Comments
 (0)