PHP Class Psecio\Gatekeeper\DataSource

Show file Open project: psecio/gatekeeper Class Usage Examples

Public Properties

Property Type Description
$config array Data source configuration options
$lastError string Last error from a datasource request

Public Methods

Method Description
__construct ( array $config ) Init the object and set the configuration
count ( Modler\Model $model, array $where = [] ) : boolean Return the number of entities in DB per condition or in general
create ( Modler\Model $model ) : boolean Create a new record with model given
delete ( Modler\Model $model ) : boolean Delete the record defined by the model data
find ( Modler\Model $model, array $where = [] ) : object Find and populate a model based on the model type and where criteria
getConfig ( ) : array Get the configuration settings
getLastError ( ) : string Return the last error from action taken on the datasource
save ( Modler\Model $model ) : boolean Save the given model
setConfig ( array $config ) Set the configuration
update ( Modler\Model $model ) : boolean Update the record for the given model

Method Details

__construct() public method

Init the object and set the configuration
public __construct ( array $config )
$config array Configuration settings

count() abstract public method

Return the number of entities in DB per condition or in general
abstract public count ( Modler\Model $model, array $where = [] ) : boolean
$model Modler\Model Model instance
$where array
return boolean Success/fail of action

create() abstract public method

Create a new record with model given
abstract public create ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
return boolean Success/fail of action

delete() abstract public method

Delete the record defined by the model data
abstract public delete ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
return boolean Success/fail of action

find() abstract public method

Find and populate a model based on the model type and where criteria
abstract public find ( Modler\Model $model, array $where = [] ) : object
$model Modler\Model Model instance
$where array "Where" data to locate record
return object Either a collection or model instance

getConfig() public method

Get the configuration settings
public getConfig ( ) : array
return array Config settings

getLastError() abstract public method

Return the last error from action taken on the datasource
abstract public getLastError ( ) : string
return string Error string

save() abstract public method

Save the given model
abstract public save ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
return boolean Success/fail of action

setConfig() public method

Set the configuration
public setConfig ( array $config )
$config array Config settings

update() abstract public method

Update the record for the given model
abstract public update ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
return boolean Success/fail of action

Property Details

$config public property

Data source configuration options
public array $config
return array

$lastError public property

Last error from a datasource request
public string $lastError
return string