Class CActiveDataProvider
CActiveDataProvider implements a data provider based on ActiveRecord.
CActiveDataProvider provides data in terms of ActiveRecord objects which are
of class CActiveDataProvider::$modelClass. It uses the AR CActiveRecord::findAll()
method to retrieve the data from database. The criteria property can be
used to specify various query options.
CActiveDataProvider may be used in the following way:
$dataProvider=new CActiveDataProvider('Post', array(
'criteria'=>array(
'condition'=>'status=1',
'order'=>'create_time DESC',
'with'=>array('author'),
),
'countCriteria'=>array(
'condition'=>'status=1',
// 'order' and 'with' clauses have no meaning for the count query
),
'pagination'=>array(
'pageSize'=>20,
),
));
// $dataProvider->getData() will return a list of Post objects
- CComponent
-
CDataProvider
implements
IDataProvider
-
CActiveDataProvider
Direct known subclasses
SmartActiveDataProviderCopyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1
Located at x2engine/framework/web/CActiveDataProvider.php
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
|
protected
array
|
|
protected
array
|
|
protected
integer
|
getData(),
getId(),
getItemCount(),
getKeys(),
getPagination(),
getTotalItemCount(),
setData(),
setId(),
setKeys(),
setPagination(),
setSort(),
setTotalItemCount()
|
public
string
|
$modelClass | |
#
the primary ActiveRecord class name. The |
public
|
$model | |
#
the AR finder instance (eg |
public
string
|
$keyAttribute | |
#
the name of key attribute for |
public
|
$criteria |
#
The query criteria. |
public
|
$countCriteria |
#
The count query criteria. This property is available since 1.1.14 |
public
|
$sort |
#
The sorting object. If this is false, it means the sorting is disabled. |
$data,
$id,
$itemCount,
$keys,
$pagination,
$totalItemCount
|