Property | Type | Description | |
---|---|---|---|
$auto_track_element | When controller is added into model, the model will automatically keep track of it and will not dispose of it. | ||
$default_exception | |||
$supportConditions | Conditions can be set on non-primary field. This capability of data controller allows your model to use methods such as addCondition, loadBy, tryLoadBy etc. Each of those methods can be supplied with two arguments - the field and value and exact matching will be used. For three-argument use, see property $supportOperators. | ||
$supportLimit | Limit makes it possible to specify count / skip for the model, which is necessary for pagination. | ||
$supportOperators | Controller is required to support '>', '<', '=', '!=', '<=', '>=' operators even if database uses diffirent notation, due to consistency. If database supports additional operators, you can list them as an array in this attribute, e.g.: ['like','is','is not']. You may also set $supportOperators='all' which will indicate that this controller supports all possible operators, although this is not advised. | ||
$supportOrder | Controller allows re-ordering data set by non-primary field in either ascending or descending order. Models support ordering on multiple fields. If controller does not support multiple ordering fields, then the last field to be used for ordering must take precedence. | ||
$supportRef | This would be supported by most data controllers. |
Method | Description | |
---|---|---|
d ( $model ) | ||
delete ( $model, $id ) | Locate and remove record in the storade with specified $id. Return true if record was deleted or false if it wasn't found. In most cases, the record data will first be loaded and then deleted, just to make sure the record is accessible with specified conditions, so you can silently ignore error. | |
loadById ( $model, $id ) | Locate and load data for a specified record. If data backend supports selective loading of fields, you may call model->getActualFields to get a list of required fields for a model. When non-array is returned, you should load all fields. | |
loadCurrent ( $model, &$cursor ) | Load next data row from cursor. | |
prefetchAll ( $model ) | Create a new cursor and load model with the first entry. Returns cursor, which will then be passed to loadCurrent() for loading more results. | |
save ( $model, $id, $data ) | Writes record containing $data into the data store under id=$id. | |
setSource ( $model, $data ) | Associates model with the collection/table in this data store identified by second argument. For instance for Controller_Data_SQL the second argument would be a table. |
abstract public delete ( $model, $id ) |
abstract public loadById ( $model, $id ) |
abstract public prefetchAll ( $model ) |
abstract public save ( $model, $id, $data ) |
public setSource ( $model, $data ) |
public $auto_track_element |
public $supportConditions |
public $supportLimit |
public $supportOperators |
public $supportOrder |