After Save
public function onAfterSave{$table}( array $src, bool $is_new, JTable $table ) : void
Fires after saving a record.
Description
This hook is triggered after creating or updating a record. External plugins can use this hook to perform further actions after saving a record.
The dynamic portion of the hook name, $table
, refers to the name of the table calling the hook. This means that, for example, the room table will trigger an hook called onAfterSaveRoom
. The name of the table is always equals to the base name of the file that declares the $table
instance.
It is possible to fetch the name of a table by accessing the following folder:
/administrator/components/com_vikrestaurants/tables/
Parameters
- $src
-
(array) The properties of the table that have been saved.
- $is_new
-
(bool) True in case of insert, false in case of update.
- $table
-
(JTable) The table instance.
Return Value
None.
Example
/**
* Trigger hook to allow the plugins to make something after
* saving a record.
*
* @param mixed $data The saved record.
* @param bool $isNew True if new, false in case of update.
* @param JTable $table The table instance.
*
* @return void
*/
public function onAfterSaveReservation($data, $isNew, $table)
{
/**
* @todo do something after saving a record
*/
}
Changelog
Version | Description |
---|---|
1.8 | Introduced. |
Last Update: 2023-12-29 14:15
Helpful?