Skip to content

docs: add detailed explanation about paginate() and beforeFind model event#9618

Merged
michalsn merged 1 commit into
codeigniter4:developfrom
michalsn:docs/model-paginate
Jul 5, 2025
Merged

docs: add detailed explanation about paginate() and beforeFind model event#9618
michalsn merged 1 commit into
codeigniter4:developfrom
michalsn:docs/model-paginate

Conversation

@michalsn

@michalsn michalsn commented Jul 1, 2025

Copy link
Copy Markdown
Member

Description
This PR adds a note explaining the potential inconsistency when using the Model::paginate() method in combination with the beforeFind event. It aims to help prevent confusion when paginate() is used alongside query-modifying events.

Resolving this issue is non-trivial, as it would require a careful redesign of the pagination logic or parts of the model to ensure consistent behavior across both data retrieval and counting queries.

Due to this complexity, we are not applying a framework-level fix at this time. Instead, this note provides clear guidance so that developers are aware of the behavior and can plan accordingly.

This note will remain in place to support users until a long-term solution is identified and adopted.

Closes #9617

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the documentation Pull requests for documentation only label Jul 1, 2025

@neznaika0 neznaika0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@paulbalandan paulbalandan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I share the same sentiment as #8412 (comment) so I'm approving this instead of the other one.

@michalsn michalsn merged commit 228ba7d into codeigniter4:develop Jul 5, 2025
4 checks passed
@michalsn

michalsn commented Jul 5, 2025

Copy link
Copy Markdown
Member Author

Thank you @paulbalandan and @neznaika0

@michalsn michalsn deleted the docs/model-paginate branch July 14, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Pull requests for documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants