-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pageParameterName not supported #815
Comments
I just tried and see that the expected behaviour is what I get. |
your new knp_pagination_query function no longer supports "pageParameterName" |
The link is generated correctly for me, but the page is not advancing indeed. |
Yes i have copied Older version |
Same problem here: |
Could you try this patch on your vendor knp-paginator-bundle dir? --- a/src/Twig/Extension/PaginationRuntime.php
+++ b/src/Twig/Extension/PaginationRuntime.php
@@ -113,16 +113,18 @@ final class PaginationRuntime implements RuntimeExtensionInterface
* @param int $page
* @return array<string, mixed>
*/
- public function getQueryParams(array $query, int $page): array
+ public function getQueryParams(array $query, int $page, ?SlidingPaginationInterface $pagination = null): array
{
+ $pageName = $pagination?->getPaginatorOption('page_name') ?? $this->pageName;
+
if ($page === 1 && $this->skipFirstPageLink) {
- if (isset($query[$this->pageName])) {
- unset($query[$this->pageName]);
+ if (isset($query[$pageName])) {
+ unset($query[$pageName]);
}
return $query;
}
- return array_merge($query, [$this->pageName => $page]);
+ return array_merge($query, [$pageName => $page]);
}
} if you confirm it works, I'll release a patch version later today |
Hello, It work for me : `public function getQueryParams(array $query, int $page, ?string $pageParameterName = null): array
on Twig function add pageParameterName |
The variable is the pagination object passed to your template |
The solution of Vertica works indeed
And in all places (all templates) change |
I'm sure it works, but it would force use to extract the pageParameterName to be passed everywhere. Moreover, it's not future-proof: if one day we find in the need of another option, we would be forced to add a new argument. |
Bug Report
Summary
Parameter "pageParameterName" is not supported in links
Current behavior
Exemple with bootstrap 4: link is /suivi?page=2
How to reproduce
$paginator->paginate($repo->relanceDemande(),$request->query->getInt('pageRelanceDemande',1),50,['pageParameterName'=>'pageRelanceDemande']);
Expected behavior
link : /suivi?pageRelanceDemande=2
The text was updated successfully, but these errors were encountered: