Skip to content

Commit 228ba7d

Browse files
authored
docs: add detailed explanation about paginate() and beforeFind model event (#9618)
1 parent 3d019b0 commit 228ba7d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

user_guide_src/source/models/model.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,15 @@ afterUpdateBatch **data** = the key/value pairs being updated.
10321032
**result** = the results of the ``updateBatch()`` method used through the Query Builder.
10331033
================= =========================================================================================================
10341034

1035+
.. note:: When using the ``paginate()`` method in combination with the ``beforeFind`` event to modify the query,
1036+
the results may not behave as expected.
1037+
1038+
This is because the ``beforeFind`` event only affects the actual retrieval of the results (``findAll()``),
1039+
but **not** the query used to count the total number of rows for pagination.
1040+
1041+
As a result, the total row count used for generating pagination links may not reflect the modified query conditions,
1042+
leading to inconsistencies in pagination.
1043+
10351044
Modifying Find* Data
10361045
====================
10371046

0 commit comments

Comments
 (0)