Class FileSystemObjectDataProvider
CArrayDataProvider implements a data provider based on a raw data array.
The CArrayDataProvider::$rawData
property contains all data that may be sorted and/or
paginated. CArrayDataProvider will supply the data after sorting and/or
pagination. You may configure the sort and pagination properties
to customize sorting and pagination behaviors.
Elements in the raw data array may be either objects (e.g. model objects) or
associative arrays (e.g. query results of DAO). Make sure to set the CArrayDataProvider::$keyField
property to the name of the field that uniquely identifies a data
record or false if you do not have such a field.
CArrayDataProvider may be used in the following way:
$rawData=Yii::app()->db->createCommand('SELECT * FROM tbl_user')->queryAll(); // or using: $rawData=User::model()->findAll(); $dataProvider=new CArrayDataProvider($rawData, array( 'id'=>'user', 'sort'=>array( 'attributes'=>array( 'id', 'username', 'email', ), ), 'pagination'=>array( 'pageSize'=>10, ), )); // $dataProvider->getData() will return a list of arrays.
Note: if you want to use the sorting feature, you must configure sort property so that the provider knows which columns can be sorted.
- CComponent
- CDataProvider implements IDataProvider
- CArrayDataProvider
- FileSystemObjectDataProvider
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1.4
Located at x2engine/protected/modules/docs/components/FileSystemObjectDataProvider.php
protected
array
|
__construct(),
calculateTotalItemCount(),
fetchData(),
getSortDirections(),
getSortingFieldValue(),
sortData()
|
getData(),
getId(),
getItemCount(),
getKeys(),
getPagination(),
getSort(),
getTotalItemCount(),
setData(),
setId(),
setKeys(),
setPagination(),
setSort(),
setTotalItemCount()
|
__call(),
__get(),
__isset(),
__set(),
__unset(),
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
$caseSensitiveSort,
$keyField,
$rawData
|
$data,
$id,
$itemCount,
$keys,
$pagination,
$sort,
$totalItemCount
|