Skip to content

Commit ac44308

Browse files
committed
docs: change model event order
Place batch methods after.
1 parent fbd0ebe commit ac44308

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

user_guide_src/source/models/model.rst

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,10 @@ $beforeInsert
244244
^^^^^^^^^^^^^
245245
$afterInsert
246246
^^^^^^^^^^^^
247-
$beforeInsertBatch
248-
^^^^^^^^^^^^^^^^^^
249-
$afterInsertBatch
250-
^^^^^^^^^^^^^^^^^
251247
$beforeUpdate
252248
^^^^^^^^^^^^^
253249
$afterUpdate
254250
^^^^^^^^^^^^^
255-
$beforeUpdateBatch
256-
^^^^^^^^^^^^^^^^^^
257-
$afterUpdateBatch
258-
^^^^^^^^^^^^^^^^^
259251
$beforeFind
260252
^^^^^^^^^^^
261253
$afterFind
@@ -264,6 +256,14 @@ $beforeDelete
264256
^^^^^^^^^^^^^
265257
$afterDelete
266258
^^^^^^^^^^^^
259+
$beforeInsertBatch
260+
^^^^^^^^^^^^^^^^^^
261+
$afterInsertBatch
262+
^^^^^^^^^^^^^^^^^
263+
$beforeUpdateBatch
264+
^^^^^^^^^^^^^^^^^^
265+
$afterUpdateBatch
266+
^^^^^^^^^^^^^^^^^
267267

268268
These arrays allow you to specify callback methods that will be run on the data at the
269269
time specified in the property name.
@@ -718,10 +718,17 @@ Model Events
718718
************
719719

720720
There are several points within the model's execution that you can specify multiple callback methods to run.
721-
These methods can be used to normalize data, hash passwords, save related entities, and much more. The following
722-
points in the model's execution can be affected, each through a class property: ``$beforeInsert``, ``$afterInsert``,
723-
``$beforeInsertBatch``, ``$afterInsertBatch``, ``$beforeUpdate``, ``$afterUpdate``, ``$beforeUpdateBatch``,
724-
``$afterUpdateBatch``, ``$afterFind``, and ``$afterDelete``.
721+
These methods can be used to normalize data, hash passwords, save related entities, and much more.
722+
723+
The following
724+
points in the model's execution can be affected, each through a class property:
725+
726+
- `$beforeInsert`_, `$afterInsert`_
727+
- `$beforeUpdate`_, `$afterUpdate`_
728+
- `$beforeFind`_, `$afterFind`_
729+
- `$beforeDelete`_, `$afterDelete`_
730+
- `$beforeInsertBatch`_, `$afterInsertBatch`_
731+
- `$beforeUpdateBatch`_, `$afterUpdateBatch`_
725732

726733
.. note:: ``$beforeInsertBatch``, ``$afterInsertBatch``, ``$beforeUpdateBatch`` and
727734
``$afterUpdateBatch`` can be used since v4.3.0.
@@ -769,20 +776,12 @@ beforeInsert **data** = the key/value pairs that are being inserted. If an
769776
afterInsert **id** = the primary key of the new row, or 0 on failure.
770777
**data** = the key/value pairs being inserted.
771778
**result** = the results of the insert() method used through the Query Builder.
772-
beforeInsertBatch **data** = associative array of values that are being inserted. If an object or Entity class is passed to the
773-
insertBatch method, it is first converted to an array.
774-
afterInsertBatch **data** = the associative array of values being inserted.
775-
**result** = the results of the insertbatch() method used through the Query Builder.
776779
beforeUpdate **id** = the array of primary keys of the rows being updated.
777780
**data** = the key/value pairs that are being updated. If an object or Entity class is passed to the
778781
update method, it is first converted to an array.
779782
afterUpdate **id** = the array of primary keys of the rows being updated.
780783
**data** = the key/value pairs being updated.
781784
**result** = the results of the update() method used through the Query Builder.
782-
beforeUpdateBatch **data** = associative array of values that are being updated. If an object or Entity class is passed to the
783-
updateBatch method, it is first converted to an array.
784-
afterUpdateBatch **data** = the key/value pairs being updated.
785-
**result** = the results of the updateBatch() method used through the Query Builder.
786785
beforeFind The name of the calling **method**, whether a **singleton** was requested, and these additional fields:
787786
- first() No additional fields
788787
- find() **id** = the primary key of the row being searched for.
@@ -796,6 +795,14 @@ afterDelete **id** = primary key of row being deleted.
796795
**purge** = boolean whether soft-delete rows should be hard deleted.
797796
**result** = the result of the delete() call on the Query Builder.
798797
**data** = unused.
798+
beforeInsertBatch **data** = associative array of values that are being inserted. If an object or Entity class is passed to the
799+
insertBatch method, it is first converted to an array.
800+
afterInsertBatch **data** = the associative array of values being inserted.
801+
**result** = the results of the insertbatch() method used through the Query Builder.
802+
beforeUpdateBatch **data** = associative array of values that are being updated. If an object or Entity class is passed to the
803+
updateBatch method, it is first converted to an array.
804+
afterUpdateBatch **data** = the key/value pairs being updated.
805+
**result** = the results of the updateBatch() method used through the Query Builder.
799806
================= =========================================================================================================
800807

801808
Modifying Find* Data

0 commit comments

Comments
 (0)