Implement this interface to perform specific things when objects are manipulated

Note that those methods will be called when objects are manipulated, either in a programmatic way or through the GUI.

package Extensibility
api

 Methods

Invoked to determine wether an object can be deleted from the database

OnCheckToDelete(\DBObject $oObject) : string[]

The GUI calls this verb and stops the deletion process if any issue is reported.

Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.

Parameters

$oObject

\DBObject

The target object

Returns

string[]A list of errors message. An error message is made of one line and it can be displayed to the end-user.

Invoked to determine wether an object can be written to the database

OnCheckToWrite(\DBObject $oObject) : string[]

The GUI calls this verb and reports any issue. Anyhow, this API can be called in other contexts such as the CSV import tool.

Parameters

$oObject

\DBObject

The target object

Returns

string[]A list of errors message. An error message is made of one line and it can be displayed to the end-user.

Invoked when an object is deleted from the database

OnDBDelete(\DBObject $oObject, \CMDBChange | null $oChange) : void

The method is called right before the object will be deleted from the database.

Parameters

$oObject

\DBObject

The target object

$oChange

\CMDBChangenull

A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information once for all the changes made within the current page

Invoked when an object is created into the database

OnDBInsert(\DBObject $oObject, \CMDBChange | null $oChange) : void

The method is called right after the object has been written to the database.

Parameters

$oObject

\DBObject

The target object

$oChange

\CMDBChangenull

A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information once for all the changes made within the current page

Invoked when an object is updated into the database

OnDBUpdate(\DBObject $oObject, \CMDBChange | null $oChange) : void

The method is called right after the object has been written to the database.

Parameters

$oObject

\DBObject

The target object

$oChange

\CMDBChangenull

A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information once for all the changes made within the current page

Invoked to determine wether an object has been modified in memory

OnIsModified(\DBObject $oObject) : boolean

The GUI calls this verb to determine the message that will be displayed to the end-user. Anyhow, this API can be called in other contexts such as the CSV import tool.

If the extension returns false, then the framework will perform the usual evaluation. Otherwise, the answer is definitively "yes, the object has changed".

Parameters

$oObject

\DBObject

The target object

Returns

booleanTrue if something has changed for the target object