Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name of eventDescriptionExpected parameters
CREATE_BEFOREExecuted before an item is created.none
CREATE_FAILUREExecuted if item could not be created.none
CREATE_SUCCESSExecuted it item could be created successfully.ID of created item
STORE_BEFOREExecuted before store process is executed.Item instance
STORE_FAILUREExecuted if store process failed.
This is also likely to happen if query would not change anything in database! 
Item instance
STORE_SUCCESSExecuted if store process saved the values in the database.Item instance
DELETE_BEFOREExecuted before deleting an itemID of the item to delete
DELETE_FAILUREExecuted if deletion of an item failsID of the item to delete
DELETE_SUCCESSExecuted 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
languagephp
titleExamples
linenumberstrue
// 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');