Class cGenericDb.
Handles the generic execution of callbacks.
copyright | four for business AG |
---|
register(string $event, mixed $callback, mixed $class) : void
Example: cGenericDb::register(cGenericDb::CREATE_SUCCESS, 'itemCreateHandler', 'cApiArticle'); cGenericDb::register(cGenericDb::CREATE_SUCCESS, array('cCallbackHandler', 'executeCreateHandle'), 'cApiArticle');
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Callback to register
mixed
Class name for registering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if event or class are not set or the callback is not callable |
---|
unregister(string $event, mixed $class) : void
Example: cGenericDb::unregister(cGenericDb::CREATE_SUCCESS, 'cApiArticle');
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Class name for unregistering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if the event or the class are not set |
---|
_executeCallbacks(string $event, string $class, array $arguments) : void
string
Callback event, must be a valid value of a cGenericDb event constant
string
Class name for executing callback
array
Arguments to pass to the callback function
\cInvalidArgumentException |
if the event or class is not set |
---|
$_callbacks : array
CREATE_BEFORE
Expected parameters for callback: none
CREATE_FAILURE
Expected parameters for callback: none
CREATE_SUCCESS
Expected parameters for callback: ID of created item
DELETE_BEFORE
Expected parameters for callback: ID of them item to delete
DELETE_FAILURE
Expected parameters for callback: ID of them item to delete
DELETE_SUCCESS
Expected parameters for callback: ID of them item to delete
STORE_BEFORE
Expected parameters for callback: Item instance
STORE_FAILURE
This is also likely to happen if query would not change anything in database! Expected parameters for callback: Item instance
STORE_SUCCESS
Expected parameters for callback: Item instance