OpenMediaVault  3.0 (Erasmus)
The open network attached storage solution
Public Member Functions | List of all members
OMV\Config\DataModel Class Reference
Inheritance diagram for OMV\Config\DataModel:
OMV\DataModel\DataModel

Public Member Functions

 __construct ($model)
 
 __clone ()
 
 getPropertiesSchema ()
 
 getQueryInfo ()
 
 isIdentifiable ()
 
 getIdProperty ()
 
 isIterable ()
 
 isReferenceable ()
 
 getRefProperty ()
 
 isPersistent ()
 
 getNotificationId ()
 
 validate ($data)
 
 validateProperty ($path, $value)
 
 addProperty ($path, $type, array $schema=array())
 
 copyProperty ($path, $targetPath)
 
 removeProperty ($path)
 
 convertProperty ($path, $value)
 
 getPropertyDefault ($path)
 
 propertyExists ($path)
 
 assertPropertyExists ($path)
 
 assertPropertyNotExists ($path)
 
 walkRecursive ($path, $callback, &$userData=NULL)
 
- Public Member Functions inherited from OMV\DataModel\DataModel
 __construct ($model)
 
 getModel ()
 
 getId ()
 
 getAlias ()
 
 getTitle ()
 
 getDescription ()
 

Member Function Documentation

OMV\Config\DataModel::addProperty (   $path,
  $type,
array  $schema = array() 
)

Add a new property to the model.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
typeThe type of the property, e.g. 'string' or 'boolean'.
Returns
None.
OMV\Config\DataModel::assertPropertyExists (   $path)

Assert that the specified property exists.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
Returns
None.
Exceptions
OMV\Config\DataModel::assertPropertyNotExists (   $path)

Assert that the specified property does not exist.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
Returns
None.
Exceptions
OMV\Config\DataModel::convertProperty (   $path,
  $value 
)

Convert the given value into the type which is declared in the property schema at the specified path. The original value is returned when the property type can not be processed, e.g. 'any', 'array', 'object' or 'null'.

Parameters
nameThe path of the property, e.g. "aaa.bbb.ccc".
valueThe value to convert.
Returns
The converted value.
OMV\Config\DataModel::copyProperty (   $path,
  $targetPath 
)

Copies a property from one item to another.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
targetPathThe path of the new property, e.g. "xxx.yyy.zzz".
Returns
None.
OMV\Config\DataModel::getNotificationId ( )

Get the notification identifier. It is auto-generated based on the data model property named 'id': 'org.openmediavault.' + <id> The identifier can be overwritten using the property that is named 'notificationid'.

Returns
The notification identifier string, e.g. 'org.openmediavault.x.y.z'.
OMV\Config\DataModel::getPropertyDefault (   $path)

Get the default value of the specified property as defined in the schema.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
Returns
The default value as specified in the schema or by the properties type.
OMV\Config\DataModel::isPersistent ( )

Tests whether the data model instance is persistent.

Returns
TRUE if the data model instance is persistent. If the property is not available in the data model definition, then TRUE is assumed.
OMV\Config\DataModel::propertyExists (   $path)

Check if the specified property exists.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
Returns
TRUE if the property exists, otherwise FALSE.
OMV\Config\DataModel::removeProperty (   $path)

Add a property from the model.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
OMV\Config\DataModel::validate (   $data)

Validate the specified data against the data model.

Parameters
dataThe JSON data to validate.
Returns
None.
Exceptions
OMV\Config\DataModel::walkRecursive (   $path,
  $callback,
$userData = NULL 
)

Apply a user function recursively to every property of the schema.

Parameters
pathThe path of the property, e.g. "aaa.bbb.ccc".
callbackThe callback function.
userdataIf the optional userdata parameter is supplied, it will be passed to the callback function.

The documentation for this class was generated from the following file: