Skip to content

Commit

Permalink
bug #6496 Fix next page url (danut007ro)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.x branch.

Discussion
----------

Fix next page url

When using `AssociationField` and there are no more pages for a result the `generateUrl()` method will be called on `null`.

This PR adds a check when calling `$nextPageUrl->generateUrl()`.

Commits
-------

ac3ef8b Fix next page url
  • Loading branch information
javiereguiluz committed Nov 3, 2024
2 parents 0e17248 + ac3ef8b commit 9e0ef39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Orm/EntityPaginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function getResultsAsJson(): string
$nextPageUrl->setController($crudControllerFqcn)->setAction($currentRequest->attributes->get(EA::CRUD_ACTION));
}

$jsonResult['next_page'] = $nextPageUrl->generateUrl();
$jsonResult['next_page'] = $nextPageUrl?->generateUrl();

return json_encode($jsonResult, \JSON_THROW_ON_ERROR);
}
Expand Down

0 comments on commit 9e0ef39

Please sign in to comment.