You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -418,16 +418,16 @@ Notes:
418
418
419
419
- If your extension hook updates the DataObject or another DataObject then it is likely you should use a different extension hook such as `onAfterWrite()` on the Dataobject itself rather than on the endpoint. This is because it usually shouldn't matter whether the object was created/updated/deleted via the API or a different way. These hooks are intended to facilitate the implementation of API specific code such as logging operations done via the API.
420
420
- For the `onView*()` hooks if you are adding extra data to the JSON for the response, remember to call `canView()` for any DataObjects being added as required.
421
-
- For the `onEdit*Write()` hooks you may find it useful to get the fields changed in the operations with`$obj->getChangedFields()`.
421
+
- For both of the `onEdit*Write()` hooks the `$changedFields` param is return value of`$obj->getChangedFields()` before the object was written to.
422
422
423
423
| Extension hook | Description |
424
424
| - | - |
425
425
|`onViewOne(DataObject $obj)`| Called during `GET` requests to view a single record before rendering JSON for response |
426
426
|`onViewMany(array $objs)`| Called during `GET` requests to view many records before rendering JSON for response |
427
427
|`onCreateBeforeWrite(DataObject $obj)`| Called during `POST` requests before calling `$obj->write()`|
428
428
|`onCreateAfterWrite(DataObject $obj)`| Called during `POST` requests after calling `$obj->write()`|
429
-
|`onEditBeforeWrite(DataObject $obj)`| Called during `PATCH` requests before calling `$obj->write()`|
430
-
|`onEditAfterWrite(DataObject $obj)`| Called during `PATCH` requests after calling `$obj->write()`|
429
+
|`onEditBeforeWrite(DataObject $obj, array $changedFields)`| Called during `PATCH` requests before calling `$obj->write()`|
430
+
|`onEditAfterWrite(DataObject $obj, array $changedFields)`| Called during `PATCH` requests after calling `$obj->write()`|
431
431
|`onDeleteBeforeDelete(DataObject $obj)`| Called during `DELETE` requests before calling `$obj->write()`|
432
432
|`onDeleteAfterDelete(DataObject $obj)`| Called during `DELETE` requests after calling `$obj->write()`|
433
433
|`onBeforeAction(DataObject $obj, string $action)`| Called during `ACTION` requests before running the action |
0 commit comments