PHP Class OEModule\PASAPI\models\PasApiAssignment

Inheritance: extends BaseActiveRecord
Show file Open project: openeyes/openeyes Class Usage Examples

Public Methods

Method Description
findByResource ( string $resource_type, string $resource_id, $internal_type = null ) : PasApiAssignment Find or create association using resource details and lock.
getInternal ( boolean $force_create = false ) : CActiveRecord Returns the internal model that this assignment is associated with (or a new instance if it has not been attached yet).
model ( $className = __CLASS__ ) : PasApiAssignment Returns the static model of the specified AR class.
rules ( ) : array
tableName ( ) : string
unlock ( ) Unlock the assignment.

Protected Methods

Method Description
getLockKey ( $resource_type, $resource_id )
lock ( $resource_type, $resource_id ) Lock the assignment so no other instances can clash with efforts to create or update the record.

Method Details

findByResource() public method

Find or create association using resource details and lock.
public findByResource ( string $resource_type, string $resource_id, $internal_type = null ) : PasApiAssignment
$resource_type string
$resource_id string
return PasApiAssignment

getInternal() public method

if force_create is true, it will create a new instance if the internal id cannot find the internal model. This allows for fault tolerance on internal models that might be deleted by other means.
public getInternal ( boolean $force_create = false ) : CActiveRecord
$force_create boolean
return CActiveRecord

getLockKey() protected method

protected getLockKey ( $resource_type, $resource_id )

lock() protected method

Lock the assignment so no other instances can clash with efforts to create or update the record.
protected lock ( $resource_type, $resource_id )
$resource_type
$resource_id

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : PasApiAssignment
return PasApiAssignment the static model class

rules() public method

public rules ( ) : array
return array validation rules for model attributes.

tableName() public method

public tableName ( ) : string
return string the associated database table name

unlock() public method

Unlock the assignment.
public unlock ( )