...
Name of event | Description | Expected parameters |
---|---|---|
CREATE_BEFORE | Executed before an item is created. | none |
CREATE_FAILURE | Executed if item could not be created. | none |
CREATE_SUCCESS | Executed it item could be created successfully. | ID of created item |
STORE_BEFORE | Executed before store process is executed. | Item instance |
STORE_FAILURE | Executed if store process failed. This is also likely to happen if query would not change anything in database! | Item instance |
STORE_SUCCESS | Executed if store process saved the values in the database. | Item instance |
DELETE_BEFORE | Executed before deleting an item | ID of the item to delete |
DELETE_FAILURE | Executed if deletion of an item fails | ID of the item to delete |
DELETE_SUCCESS | Executed if item was deleted successfully. | ID of the item to delete |
Usage
Callbacks can be registered by using the static method "register" of the "cGenericDb" class.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// callback function would be "itemCreateHandler" cGenericDb::register(cGenericDb::CREATE_SUCCESS, 'itemCreateHandler', 'cApiArticle'); // callback function would be "executeCreateHandle" in the class "cCallbackHandler" cGenericDb::register(cGenericDb::CREATE_SUCCESS, array('cCallbackHandler', 'executeCreateHandle'), 'cApiArticle'); // unregisters all "CREATE_SUCCESS" events from specified class cGenericDb::unregister(cGenericDb::CREATE_SUCCESS, 'cApiArticle'); |