PHP Class Services\ModelService

Inheritance: extends InternalService
Datei anzeigen Open project: openeyes/openeyes Class Usage Examples

Protected Properties

Property Type Description
$model
$operations Default set of operations for a model service, override if required.
$primary_model string The primary model class for this service.

Public Methods

Method Description
__construct ( BaseActiveRecord $model )
create ( Resource $resource ) : integer
getLastModified ( integer $id ) : integer
load ( array $params = [] )
read ( integer $id ) : resource
update ( integer $id, Resource $resource )

Protected Methods

Method Description
getResourcesFromDataProvider ( CActiveDataProvider $provider ) : resource[] Get a list of resources from an AR data provider.
getSearchModel ( ) : BaseActiveRecord Get an instance of the model class to fill in with search details.
modelToResource ( BaseActiveRecord $model ) : resource
readModel ( integer $id ) : BaseActiveRecord
resourceToModel ( resource $resource, BaseActiveRecord $model )
saveModel ( BaseActiveRecord $model ) * Save model object and throw a service layer exception on failure

Method Details

__construct() public method

public __construct ( BaseActiveRecord $model )
$model BaseActiveRecord

create() public method

public create ( Resource $resource ) : integer
$resource Resource
return integer

getLastModified() public method

public getLastModified ( integer $id ) : integer
$id integer
return integer

getResourcesFromDataProvider() protected method

Get a list of resources from an AR data provider.
protected getResourcesFromDataProvider ( CActiveDataProvider $provider ) : resource[]
$provider CActiveDataProvider
return resource[]

getSearchModel() protected method

Get an instance of the model class to fill in with search details.
protected getSearchModel ( ) : BaseActiveRecord
return BaseActiveRecord

load() public static method

public static load ( array $params = [] )
$params array

modelToResource() protected method

protected modelToResource ( BaseActiveRecord $model ) : resource
$model BaseActiveRecord
return resource

read() public method

public read ( integer $id ) : resource
$id integer
return resource

readModel() protected method

protected readModel ( integer $id ) : BaseActiveRecord
$id integer
return BaseActiveRecord

resourceToModel() protected method

protected resourceToModel ( resource $resource, BaseActiveRecord $model )
$resource resource
$model BaseActiveRecord

saveModel() protected method

* Save model object and throw a service layer exception on failure
protected saveModel ( BaseActiveRecord $model )
$model BaseActiveRecord

update() public method

public update ( integer $id, Resource $resource )
$id integer
$resource Resource

Property Details

$model protected_oe property

protected $model

$operations protected_oe static_oe property

Default set of operations for a model service, override if required.
protected static $operations

$primary_model protected_oe static_oe property

The primary model class for this service.
protected static string $primary_model
return string