Sidebar

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

πŸ”™ Back

MetaModel

abstract api

The objects definitions as well as their mapping to the database

API synthesis

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

  • GetObject() β€” Instantiate an object already persisted to the Database.
  • IsValidAttCode() β€” Check it the given attribute exists in the specified class
  • IsValidClass() β€” Check if the given class name is actually a persistent class
  • NewObject() β€” Instantiate a persistable object (not yet persisted)

Public methods

GetObject

api public static

Instantiate an object already persisted to the Database.
public static GetObject($sClass, $iKey, $bMustBeFound = true, $bAllowAllData = false, $aModifierProperties = null)

Parameters

types name default description
string $sClass
integer $iKey id value of the object to retrieve
boolean $bMustBeFound true see throws ArchivedObjectException
boolean $bAllowAllData false if true then user rights will be bypassed - use with care!
null $aModifierProperties null

Returns

\DBObject null if : (the object is not found) or (archive mode disabled and object is archived and $bMustBeFound=false)

Throws

  • \CoreException if no result found and $bMustBeFound=true
  • \ArchivedObjectException if archive mode disabled and result is archived and $bMustBeFound=true
  • \Exception

See also

IsValidAttCode

api final public static

Check it the given attribute exists in the specified class
final public static IsValidAttCode($sClass, $sAttCode, $bExtended = false)

Parameters

types name default description
string $sClass Class name
string $sAttCode Attribute code
boolean $bExtended false Allow the extended syntax: extkey_id→remote_attcode

Returns

boolean

Throws

\Exception

IsValidClass

api public static

Check if the given class name is actually a persistent class
public static IsValidClass($sClass)

Parameters

types name default description
string $sClass

Returns

boolean

NewObject

api public static

Instantiate a persistable object (not yet persisted)
public static NewObject($sClass, $aValues = null)

Parameters

types name default description
string $sClass A persistable class
array|null $aValues null array of attcode β‡’ attribute value to preset

Returns

\cmdbAbstractObject

Throws

\CoreException

πŸ”™ Back

latest/customization/api/objects-manipulation/metamodel.txt Β· Last modified: 2023/07/21 10:19 (external edit)
Back to top
Contact us