Skip to content

Add nbPages property to Page#92

Open
koriym wants to merge 1 commit into
1.xfrom
add-page-nbpages
Open

Add nbPages property to Page#92
koriym wants to merge 1 commit into
1.xfrom
add-page-nbpages

Conversation

@koriym

@koriym koriym commented Jul 4, 2026

Copy link
Copy Markdown
Member

Summary

Pagerfanta exposes getNbPages() (the total number of pages), but Ray's Page only surfaces total (the result count), never the page count. Every consumer therefore had to recompute ceil(total / maxPerPage) by hand, duplicating logic that already lives in Pagerfanta.

Changes

  • Add a public $nbPages property to Page.
  • Populate it from Pagerfanta::getNbPages() in both AuraSqlPager and AuraSqlQueryPager, alongside the existing total assignment.

Non-breaking: only an additive property on a final value object.

Verification

  • phpunit: 76 tests, 146 assertions OK
  • phpstan: OK
  • psalm: OK
  • phpcs: blocked by an existing tooling issue on PHP 8.5 (No files were checked); the change mirrors the existing property style.

Pagerfanta exposes getNbPages() (the total number of pages), but Ray's
Page only surfaced `total` (the result count), never the page count.
Every consumer therefore had to recompute `ceil(total / maxPerPage)` by
hand, duplicating logic that already lives in Pagerfanta.

Add a public `$nbPages` property to Page and populate it from
`Pagerfanta::getNbPages()` in both AuraSqlPager and AuraSqlQueryPager,
so the page count is available alongside the existing total/maxPerPage
fields without breaking the current API.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@koriym, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73945647-8442-458b-a81a-32e0a9096551

📥 Commits

Reviewing files that changed from the base of the PR and between 9034424 and 6e13740.

📒 Files selected for processing (4)
  • src/Pagerfanta/AuraSqlPager.php
  • src/Pagerfanta/AuraSqlQueryPager.php
  • src/Pagerfanta/Page.php
  • tests/Pagerfanta/AuraSqlQueryPagerTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-page-nbpages

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (22738b2) to head (6e13740).
⚠️ Report is 1 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x       #92   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       142       142           
===========================================
  Files             41        41           
  Lines            505       507    +2     
===========================================
+ Hits             505       507    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant