PHP Class OEModule\PASAPI\resources\BaseResource

Afficher le fichier Open project: openeyes/openeyes Class Usage Examples

Méthodes publiques

Свойство Type Description
$errors
$id string Resource ID.
$partial_record boolean Property that will allow subset of data to be updated on the resource.
$update_only boolean Property that will prevent a model being created if its set to true.
$warn_errors boolean Flag that will force all errors on the resource to be mapped to warnings.
$warnings

Protected Properties

Свойство Type Description
$assignment OEModule\PASAPI\models\PasApiAssignment
$resource_type
$schema
$version

Méthodes publiques

Méthode Description
__construct ( $version, array $options = [] ) BaseResource constructor.
addAuditData ( $key, $value ) Add to audit data property.
assignProperty ( $model, $model_key, $resource_key )
audit ( $audit_type, null $data = null, null $msg = null, array $properties = [] ) Wrapper for auditing calls on resource changes.
fromResourceId ( $version, $id ) : BaseResource Instantiate the resource from the external ID.
fromXml ( $version, $xml, array $options = [] ) : null | BaseResource Create an instance from an XML string.
fromXmlDom ( $version, DOMElement $element, array $options = [] ) : static instantiates a resource with the given XML Document.
getAssignedProperty ( $name )
getAssignment ( ) : PasApiAssignment
getAuditData ( ) : string Returns the json encoded audit data for logging.
getAuditTarget ( ) : string Simple wrapper to retrieve a type for auditing.
parseXml ( DOMElement $root, $options = [] ) Parses XML to define resource attributes.
remapValues ( $doc, XpathRemap[] $remaps = [] ) Update the given doc nodes as per the provided remaps.
setAssignment ( PasApiAssignment $assignment )
shouldValidateRequired ( ) : boolean
validate ( ) : boolean Base validator of resource from schema definition.

Méthodes protégées

Méthode Description
addError ( $msg ) Error logger.
addModelErrors ( $errors ) Convenience wrapper for handling model validation errors.
addWarning ( $msg ) Warning logger.
errorInit ( $version, $errors ) : static Convenience function to create a resource instance with error messages.
getInstanceForClass ( $class, $args = [] ) : mixed Abstraction for getting instance of class.
getSchema ( $version ) : mixed Get the schema for the resource type based on the given version.
startTransaction ( ) : CDbTransaction | null Wrapper for starting a transaction.

Method Details

__construct() public méthode

BaseResource constructor.
public __construct ( $version, array $options = [] )
$version
$options array

addAuditData() public méthode

Add to audit data property.
public addAuditData ( $key, $value )
$key
$value

addError() protected méthode

Error logger.
protected addError ( $msg )
$msg

addModelErrors() protected méthode

Convenience wrapper for handling model validation errors.
protected addModelErrors ( $errors )
$errors

addWarning() protected méthode

Warning logger.
protected addWarning ( $msg )
$msg

assignProperty() public méthode

public assignProperty ( $model, $model_key, $resource_key )
$model
$model_key
$resource_key

audit() public méthode

Wrapper for auditing calls on resource changes.
public audit ( $audit_type, null $data = null, null $msg = null, array $properties = [] )
$audit_type
$data null
$msg null
$properties array

errorInit() protected static méthode

Convenience function to create a resource instance with error messages.
protected static errorInit ( $version, $errors ) : static
$errors array
Résultat static

fromResourceId() public static méthode

Instantiate the resource from the external ID.
public static fromResourceId ( $version, $id ) : BaseResource
$version
$id
Résultat BaseResource

fromXml() public static méthode

Create an instance from an XML string.
public static fromXml ( $version, $xml, array $options = [] ) : null | BaseResource
$version
$xml
$options array
Résultat null | BaseResource

fromXmlDom() public static méthode

instantiates a resource with the given XML Document.
public static fromXmlDom ( $version, DOMElement $element, array $options = [] ) : static
$version
$element DOMElement \DOMElement
$options array
Résultat static

getAssignedProperty() public méthode

public getAssignedProperty ( $name )

getAssignment() public méthode

public getAssignment ( ) : PasApiAssignment
Résultat OEModule\PASAPI\models\PasApiAssignment

getAuditData() public méthode

Returns the json encoded audit data for logging.
public getAuditData ( ) : string
Résultat string

getAuditTarget() public méthode

Simple wrapper to retrieve a type for auditing.
public getAuditTarget ( ) : string
Résultat string

getInstanceForClass() protected méthode

Abstraction for getting instance of class.
protected getInstanceForClass ( $class, $args = [] ) : mixed
$class
Résultat mixed

getSchema() protected static méthode

Get the schema for the resource type based on the given version.
protected static getSchema ( $version ) : mixed
$version
Résultat mixed

parseXml() public méthode

Parses XML to define resource attributes.
public parseXml ( DOMElement $root, $options = [] )
$root DOMElement

remapValues() public static méthode

Update the given doc nodes as per the provided remaps.
public static remapValues ( $doc, XpathRemap[] $remaps = [] )
$doc
$remaps OEModule\PASAPI\models\XpathRemap[]

setAssignment() public méthode

public setAssignment ( PasApiAssignment $assignment )
$assignment OEModule\PASAPI\models\PasApiAssignment

shouldValidateRequired() public méthode

public shouldValidateRequired ( ) : boolean
Résultat boolean

startTransaction() protected méthode

Wrapper for starting a transaction.
protected startTransaction ( ) : CDbTransaction | null
Résultat CDbTransaction | null

validate() public méthode

Base validator of resource from schema definition.
public validate ( ) : boolean
Résultat boolean

Property Details

$assignment protected_oe property

protected PasApiAssignment,OEModule\PASAPI\models $assignment
Résultat OEModule\PASAPI\models\PasApiAssignment

$errors public_oe property

public $errors

$id public_oe property

Resource ID.
public string $id
Résultat string

$partial_record public_oe property

Property that will allow subset of data to be updated on the resource.
public bool $partial_record
Résultat boolean

$resource_type protected_oe static_oe property

protected static $resource_type

$schema protected_oe property

protected $schema

$update_only public_oe property

Property that will prevent a model being created if its set to true.
public bool $update_only
Résultat boolean

$version protected_oe property

protected $version

$warn_errors public_oe property

Flag that will force all errors on the resource to be mapped to warnings.
public bool $warn_errors
Résultat boolean

$warnings public_oe property

public $warnings