Hello.
I have a problem with paginator on cakephp 4.2.7. Paginator remove custom pass params of url, when using a few models.
Example:
https://domain.name/controller/action/pass1/
Link for sorting or paginate the link looks like this:
https://domain.name/controller/action?modelName[sort]=column&modelName[direction]=asc
The problem appeared after updating from 3.6 to 4.2
How to fix it?
Thanks.
I assume you’re seeing this problem in links that are generated by the PaginatorHelper…
I don’t remember all the details of this fix, but I did find some code where I corrected for it. I even left a comment for my future self! This may give you some clues to follow:
/**
* This tweak fixes a problem where the 'pass' values in a
* request params package won't be included in the output url.
* The pass values must be moved up out of the pass node.
*/
$pass = $params['pass'] ?? [];
$url = $params + $pass;
echo '<ul class="paging-controls">';
echo $this->Paginator->first('<< ', ['url' => $url]);
echo $this->Paginator->prev('< ', ['url' => $url]);
echo $this->Paginator->numbers(['url' => $url]);
echo $this->Paginator->next('>', ['url' => $url]);
echo $this->Paginator->last(' >>', ['url' => $url]);
Yes, problem wiht links that are generated by the PaginatorHelper.
And i’we fixed problem with paginations links like a your example, but I had to consider about model , because I use Paginating Multiple Results . But sorting of paginator - remove pass of url. If use url need to conside other query parametrs . I can make element and use it with custom url, but I hope that this problem can be fix, because it was work in cakephp 3.*