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');
stringCallback event, must be a valid value of a cGenericDb event constant
mixedCallback to register
mixedClass 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');
stringCallback event, must be a valid value of a cGenericDb event constant
mixedClass 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
stringCallback event, must be a valid value of a cGenericDb event constant
stringClass name for executing callback
arrayArguments 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