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
-
MetaModel::GetObjectWithArchive : to get object even if it's archived
-
utils::PushArchiveMode() : to enable search on archived objects
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
2_7_0/customization/api/objects-manipulation/metamodel.txt
Β· Last modified: 2020/04/15 15:23 by 127.0.0.1