File tree 3 files changed +10
-8
lines changed
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -167,9 +167,9 @@ abstract class Model implements ModelInterface
167
167
*/
168
168
protected string $ pagerQuery ;
169
169
/**
170
- * @var array<string>
170
+ * @var array<string>|null
171
171
*/
172
- protected array $ pagerAllowedQueries ;
172
+ protected array | null $ pagerAllowedQueries = null ;
173
173
/**
174
174
* Pager URL.
175
175
*
@@ -537,10 +537,7 @@ protected function setPager(Pager $pager) : static
537
537
if (isset ($ temp )) {
538
538
$ pager ->setUrl ($ temp );
539
539
}
540
- $ temp = $ this ->getPagerAllowedQueries ();
541
- if (isset ($ temp )) {
542
- $ pager ->setAllowedQueries ($ temp );
543
- }
540
+ $ pager ->setAllowedQueries ($ this ->getPagerAllowedQueries ());
544
541
$ temp = $ this ->getPagerView ();
545
542
if (isset ($ temp )) {
546
543
$ pager ->setDefaultView ($ temp );
@@ -586,7 +583,7 @@ protected function getPagerQuery() : ?string
586
583
*/
587
584
protected function getPagerAllowedQueries () : ?array
588
585
{
589
- return $ this ->pagerAllowedQueries ?? null ;
586
+ return $ this ->pagerAllowedQueries ;
590
587
}
591
588
592
589
/**
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class ModelMock extends Model
24
24
public string $ pagerView ;
25
25
public string $ pagerUrl ;
26
26
public string $ pagerQuery ;
27
- public array $ pagerAllowedQueries ;
27
+ public array | null $ pagerAllowedQueries = null ;
28
28
29
29
public function convertCase (string $ value , string $ case ) : string
30
30
{
Original file line number Diff line number Diff line change @@ -542,6 +542,11 @@ public function testPagerQuery() : void
542
542
public function testPagerAllowedQueries () : void
543
543
{
544
544
$ _SERVER ['REQUEST_URI ' ] = '/products?page=5&foo=bar&order=asc&bla=bla&per_page=10 ' ;
545
+ $ this ->model ->paginate (5 );
546
+ self ::assertSame (
547
+ 'http://localhost:8080/products?page=5&foo=bar&order=asc&bla=bla&per_page=10 ' ,
548
+ $ this ->model ->getPager ()->getCurrentPageUrl ()
549
+ );
545
550
$ this ->model ->pagerAllowedQueries = ['order ' , 'per_page ' ];
546
551
$ this ->model ->paginate (5 );
547
552
self ::assertSame (
You can’t perform that action at this time.
0 commit comments