Skip to content

Commit

Permalink
fix(PagerFactory): pager should not be lazy, so that if the page do…
Browse files Browse the repository at this point in the history
…es not exist, it will throw an exception immediately, not inside template.
  • Loading branch information
priyadi committed Jun 8, 2024
1 parent 9e49188 commit 53ea299
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# 0.9.2

* fix(`PagerFactory`): pager should not be lazy, so that if the page does not
exist, it will throw an exception immediately, not inside template.

# 0.9.1

* fix(`QueryBuilderAdapter`): use generated field names for our boundary fields
Expand Down
7 changes: 5 additions & 2 deletions packages/rekapager-bundle/src/PagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public function createPager(
$queryParams = $request->query->all();
$routeParams = array_merge($queryParams, $routeParams);


/** @var array<string,string|int> $routeParams */

$pageUrlGenerator = $this->pageUrlGeneratorFactory->createPageUrlGenerator(
Expand All @@ -106,13 +105,17 @@ public function createPager(
routeParams: $routeParams
);

return new Pager(
$pager = new Pager(
page: $page,
proximity: $proximity,
pageLimit: $pageLimit,
pageUrlGenerator: $pageUrlGenerator,
pageIdentifierEncoderLocator: $this->pageIdentifierEncoderLocator,
);

foreach ($pager->getCurrentPage() as $i);

return $pager;
}

/**
Expand Down

0 comments on commit 53ea299

Please sign in to comment.