@@ -738,12 +738,19 @@ points in the model's execution can be affected, each through a class property:
738
738
Defining Callbacks
739
739
==================
740
740
741
- You specify the callbacks by first creating a new class method in your model to use. This class will always
742
- receive a ``$data `` array as its only parameter. The exact contents of the ``$data `` array will vary between events, but
743
- will always contain a key named **data ** that contains the primary data passed to the original method. In the case
744
- of the insert* or update* methods, that will be the key/value pairs that are being inserted into the database. The
745
- main array will also contain the other values passed to the method, and be detailed later. The callback method
746
- must return the original $data array so other callbacks have the full information.
741
+ You specify the callbacks by first creating a new class method in your model to use.
742
+
743
+ This class method will always receive a ``$data `` array as its only parameter.
744
+
745
+ The exact contents of the ``$data `` array will vary between events, but will always
746
+ contain a key named ``data `` that contains the primary data passed to the original
747
+ method. In the case of the **insert*() ** or **update*() ** methods, that will be
748
+ the key/value pairs that are being inserted into the database. The main ``$data ``
749
+ array will also contain the other values passed to the method, and be detailed
750
+ in `Event Parameters `_.
751
+
752
+ The callback method must return the original ``$data `` array so other callbacks
753
+ have the full information.
747
754
748
755
.. literalinclude :: model/050.php
749
756
@@ -774,37 +781,36 @@ passed to each event:
774
781
Event $data contents
775
782
================= =========================================================================================================
776
783
beforeInsert **data ** = the key/value pairs that are being inserted. If an object or Entity class is passed to the
777
- insert method, it is first converted to an array.
784
+ `` insert() `` method, it is first converted to an array.
778
785
afterInsert **id ** = the primary key of the new row, or 0 on failure.
779
786
**data ** = the key/value pairs being inserted.
780
- **result ** = the results of the insert() method used through the Query Builder.
787
+ **result ** = the results of the `` insert() `` method used through the Query Builder.
781
788
beforeUpdate **id ** = the array of primary keys of the rows being updated.
782
789
**data ** = the key/value pairs that are being updated. If an object or Entity class is passed to the
783
- update method, it is first converted to an array.
790
+ `` update() `` method, it is first converted to an array.
784
791
afterUpdate **id ** = the array of primary keys of the rows being updated.
785
792
**data ** = the key/value pairs being updated.
786
- **result ** = the results of the update() method used through the Query Builder.
793
+ **result ** = the results of the `` update() `` method used through the Query Builder.
787
794
beforeFind The name of the calling **method **, whether a **singleton ** was requested, and these additional fields:
788
- - first() No additional fields
789
- - find() **id ** = the primary key of the row being searched for.
790
- - findAll() **limit ** = the number of rows to find.
795
+ - `` first() `` No additional fields
796
+ - `` find() `` **id ** = the primary key of the row being searched for.
797
+ - `` findAll() `` **limit ** = the number of rows to find.
791
798
**offset ** = the number of rows to skip during the search.
792
799
afterFind Same as **beforeFind ** but including the resulting row(s) of data, or null if no result found.
793
- beforeDelete Varies by delete* method. See the following:
794
- - delete() **id ** = primary key of row being deleted.
800
+ beforeDelete **id ** = primary key of row being passed to the ``delete() `` method.
795
801
**purge ** = boolean whether soft-delete rows should be hard deleted.
796
- afterDelete **id ** = primary key of row being deleted .
802
+ afterDelete **id ** = primary key of row being passed to the `` delete() `` method .
797
803
**purge ** = boolean whether soft-delete rows should be hard deleted.
798
- **result ** = the result of the delete() call on the Query Builder.
804
+ **result ** = the result of the `` delete() `` call on the Query Builder.
799
805
**data ** = unused.
800
806
beforeInsertBatch **data ** = associative array of values that are being inserted. If an object or Entity class is passed to the
801
- insertBatch method, it is first converted to an array.
807
+ `` insertBatch() `` method, it is first converted to an array.
802
808
afterInsertBatch **data ** = the associative array of values being inserted.
803
- **result ** = the results of the insertbatch() method used through the Query Builder.
809
+ **result ** = the results of the `` insertbatch() `` method used through the Query Builder.
804
810
beforeUpdateBatch **data ** = associative array of values that are being updated. If an object or Entity class is passed to the
805
- updateBatch method, it is first converted to an array.
811
+ `` updateBatch() `` method, it is first converted to an array.
806
812
afterUpdateBatch **data ** = the key/value pairs being updated.
807
- **result ** = the results of the updateBatch() method used through the Query Builder.
813
+ **result ** = the results of the `` updateBatch() `` method used through the Query Builder.
808
814
================= =========================================================================================================
809
815
810
816
Modifying Find* Data
0 commit comments