Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree

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
Extended by CDataProvider implements IDataProvider
Extended by CActiveDataProvider

Direct known subclasses

SmartActiveDataProvider
Package: system\web
Copyright: 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
Methods summary
public
# __construct( mixed $modelClass, array $config = array() )

Constructor.

Constructor.

Parameters

$modelClass
mixed
$modelClass the model class (e.g. 'Post') or the model finder instance (e.g. Post::model(), Post::model()->published()).
$config
array
$config configuration (name=>value) to be applied as the initial property values of this class.
public CDbCriteria
# getCriteria( )

Returns the query criteria.

Returns the query criteria.

Returns

CDbCriteria
the query criteria
public
# setCriteria( CDbCriteria|array $value )

Sets the query criteria.

Sets the query criteria.

Parameters

$value
CDbCriteria|array
$value the query criteria. This can be either a CDbCriteria object or an array representing the query criteria.
public CDbCriteria
# getCountCriteria( )

Returns the count query criteria.

Returns the count query criteria.

Returns

CDbCriteria
the count query criteria.

Since

1.1.14
public
# setCountCriteria( CDbCriteria|array $value )

Sets the count query criteria.

Sets the count query criteria.

Parameters

$value
CDbCriteria|array
$value the count query criteria. This can be either a CDbCriteria object or an array representing the query criteria.

Since

1.1.14
public CSort
# getSort( string $className = 'CSort' )

Returns the sorting object.

Returns the sorting object.

Parameters

$className
string
$className the sorting object class name. Parameter is available since version 1.1.13.

Returns

CSort
the sorting object. If this is false, it means the sorting is disabled.

Overrides

CDataProvider::getSort()
protected CActiveRecord
# getModel( string $className )

Given active record class name returns new model instance.

Given active record class name returns new model instance.

Parameters

$className
string
$className active record class name.

Returns

CActiveRecord
active record model instance.

Since

1.1.14
protected array
# fetchData( )

Fetches the data from the persistent data storage.

Fetches the data from the persistent data storage.

Returns

array
list of data items
protected array
# fetchKeys( )

Fetches the data item keys from the persistent data storage.

Fetches the data item keys from the persistent data storage.

Returns

array
list of data item keys.
protected integer
# calculateTotalItemCount( )

Calculates the total number of data items.

Calculates the total number of data items.

Returns

integer
the total number of data items.
Methods inherited from CDataProvider
getData(), getId(), getItemCount(), getKeys(), getPagination(), getTotalItemCount(), setData(), setId(), setKeys(), setPagination(), setSort(), setTotalItemCount()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $modelClass
#

the primary ActiveRecord class name. The CDataProvider::getData() method will return a list of objects of this class.

the primary ActiveRecord class name. The CDataProvider::getData() method will return a list of objects of this class.

public CActiveRecord $model
#

the AR finder instance (eg Post::model()). This property can be set by passing the finder instance as the first parameter to the constructor. For example, Post::model()->published().

the AR finder instance (eg Post::model()). This property can be set by passing the finder instance as the first parameter to the constructor. For example, Post::model()->published().

Since

1.1.3
public string $keyAttribute
#

the name of key attribute for CActiveDataProvider::$modelClass. If not set, it means the primary key of the corresponding database table will be used.

the name of key attribute for CActiveDataProvider::$modelClass. If not set, it means the primary key of the corresponding database table will be used.

Magic properties summary
public CDbCriteria $criteria
#

The query criteria.

The query criteria.

public CDbCriteria $countCriteria
#

The count query criteria. This property is available since 1.1.14

The count query criteria. This property is available since 1.1.14

public CSort $sort
#

The sorting object. If this is false, it means the sorting is disabled.

The sorting object. If this is false, it means the sorting is disabled.

Magic properties inherited from CDataProvider
$data, $id, $itemCount, $keys, $pagination, $totalItemCount
API documentation generated by ApiGen 2.8.0