CActiveDataProvider

Подробнее: http://www.yiiframework.com/doc/api/1.1/CActiveDataProvider

$dataProvider=new CActiveDataProvider('Post', array( 'criteria'=>array( 'condition'=>'status=1', 'order'=>'create_time DESC', 'with'=>array('author'), ), 'pagination'=>array( 'pageSize'=>20, ), ));
$criteria = new CDbCriteria(); $criteria->condition = 'id = :d'; $criteria->order = 'colum2 DESC'; $criteria->params = array(':id' => 2); $dataProvider=new CActiveDataProvider('Post', array( 'criteria'=>$criteria, 'pagination'=>array( 'pageSize'=>20, ), ));

Вложенный запрос

$dataProvider=new CActiveDataProvider('User', array( 'criteria'=>array( 'condition'=>"id=(SELECT userid FROM authassignment WHERE itemname='Object')" ), 'pagination'=>array( 'pageSize'=>Yii::app()->controller->module->user_page_size, ), ));