Sidebar

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

:: Version 3.2.0 ::

๐Ÿ”™ Back

iApplicationObjectExtension

api

Implement this interface to perform specific operations when objects are manipulated

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

API synthesis

List of the public API methods. When manipulating iApplicationObjectExtension, You can call those methods:

  • OnCheckToDelete() โ€” Invoked to determine wether an object can be deleted from the database
  • OnCheckToWrite() โ€” Invoked to determine whether an object can be written to the database
  • OnDBDelete() โ€” Invoked when an object is deleted from the database
  • OnDBInsert() โ€” Invoked when an object is created into the database
  • OnDBUpdate() โ€” Invoked when an object is updated into the database. The method is called right <b>after</b> the object has been written to thedatabase.
  • OnIsModified() โ€” Invoked to determine whether an object has been modified in memory

Public methods

OnCheckToDelete

api public

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

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.

public OnCheckToDelete($oObject)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object

Returns

array<mixed,string> A list of errors message. An error message is made of one line and it can be displayed to the end-user.

OnCheckToWrite

api public

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

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

public OnCheckToWrite($oObject)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object

Returns

array<mixed,string> A list of errors message. An error message is made of one line and it can be displayed to the end-user.

OnDBDelete

api public

Invoked when an object is deleted from the database

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

public OnDBDelete($oObject, $oChange = null)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object
\CMDBChange|null $oChange null 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

OnDBInsert

api public

Invoked when an object is created into the database

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

public OnDBInsert($oObject, $oChange = null)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object
\CMDBChange|null $oChange null 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

OnDBUpdate

api public

Invoked when an object is updated into the database. The method is called right <b>after</b> the object has been written to thedatabase.

Useful methods you can call on $oObject :

  • \DBObject::ListPreviousValuesForUpdatedAttributes() : list of changed attributes and their values before the change
  • \DBObject::Get() : for a given attribute the new value that was persisted
public OnDBUpdate($oObject, $oChange = null)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object
\CMDBChange|null $oChange null 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

Tags

since 2.7.0 Nยฐ2293 can access object changes by calling {@see DBObject::ListPreviousValuesForUpdatedAttributes()} on $oObject

OnIsModified

api public

Invoked to determine whether an object has been modified in memory

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".

public OnIsModified($oObject)

Parameters

types name default description
\cmdbAbstractObject $oObject The target object

Returns

boolean True if something has changed for the target object

๐Ÿ”™ Back

3_2_0/customization/api/extensions/iapplicationobjectextension.txt ยท Last modified: 2024/09/10 10:25 by 127.0.0.1
Back to top
Contact us