-
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
Page parameter name #820
base: master
Are you sure you want to change the base?
Page parameter name #820
Changes from all commits
ff7ee29
88018b0
ac00443
72f2d51
eaf5566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,20 +109,22 @@ | |
} | ||
|
||
/** | ||
* @param array<string, mixed> $query | ||
* @param int $page | ||
* @param array<string, mixed> $query | ||
* @param int $page | ||
* @param array<string, mixed>|null $paginatorOptions | ||
* @return array<string, mixed> | ||
*/ | ||
public function getQueryParams(array $query, int $page): array | ||
public function getQueryParams(array $query, int $page, ?array $paginatorOptions = []): array | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same name change here. Moreover, we don't need to accept a null value |
||
{ | ||
$pageName = $paginatorOptions['pageParameterName'] ?? $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]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this phpstan failure needs to be addressed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how the change which has been made can be the cause of this error? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable now can come from the options array, so it can be different from before |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{% if pageCount > 1 %} | ||
{% if previous is defined %} | ||
<link rel="prev" href="{{ path(route, knp_pagination_query(query, previous)) }}" /> | ||
<link rel="prev" href="{{ path(route, knp_pagination_query(query, previous, paginatorOptions)) }}" /> | ||
{% endif %} | ||
|
||
{% if next is defined %} | ||
<link rel="next" href="{{ path(route, knp_pagination_query(query, next)) }}" /> | ||
<link rel="next" href="{{ path(route, knp_pagination_query(query, next, paginatorOptions)) }}" /> | ||
{% endif %} | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's go with "option" as name, it's simpler