@@ -1057,6 +1057,8 @@ Sometimes, you need to process large amounts of data and would run the risk of r
10571057This is best used during cronjobs, data exports, or other large tasks. To make this simpler, you can
10581058process the data in smaller, manageable pieces using the methods below.
10591059
1060+ .. note :: The ``chunk()``, ``chunkRows()``, ``chunkById()``, and ``chunkRowsById()`` methods do not trigger Model callbacks.
1061+
10601062chunk()
10611063-------
10621064
@@ -1084,7 +1086,7 @@ If you need to update or delete rows while processing them, use ``chunkById()``.
10841086This method retrieves each chunk ordered by the model's primary key instead of using an offset,
10851087so deleting or updating rows already processed will not cause later rows to be skipped.
10861088
1087- .. literalinclude :: model/069 .php
1089+ .. literalinclude :: model/071 .php
10881090
10891091chunkRowsById()
10901092---------------
@@ -1093,11 +1095,12 @@ chunkRowsById()
10931095
10941096If you want the entire ID-based chunk to be passed to the Closure at once, use ``chunkRowsById() ``.
10951097
1096- .. literalinclude :: model/070 .php
1098+ .. literalinclude :: model/072 .php
10971099
10981100.. warning :: ID-based chunking needs the model to define a primary key, and that primary key must be selected.
10991101 If you customize the selected columns, make sure the primary key is included.
1100- When joining tables, make sure the model table primary key remains available under its normal field name.
1102+ When using joins, the model primary key must remain available under its normal field name,
1103+ and each primary key value must appear only once in the result set. Otherwise, rows may be skipped.
11011104 These methods manage their own primary key ordering and cannot be used with
11021105 ``orderBy() ``, ``groupBy() ``, ``limit() ``, ``offset() `` or ``union() ``.
11031106 You should also avoid changing primary key values while processing chunks.
0 commit comments