Yii:未定义属性“CActiveDataProvider.select”

时间:2013-11-17 20:13:06

标签: yii

我使用的是奴隶数据库,当我切换数据库连接时,这就是我得到的:

这是什么意思?

CException

Property "CActiveDataProvider.select" is not defined.

public function actionIndex() {
    $criteria = new CDbCriteria();
    $criteria->condition = 'user_id = ' . Yii::app()->user->id;
    VillageSlaveM::$server_id = Yii::app()->session['user_active_world'];
    $dataProvider = new CActiveDataProvider('VillageSlaveM', $criteria);
    $this->render('index', array(
        'dataProvider' => $dataProvider,
    ));
}

1 个答案:

答案 0 :(得分:5)

而不是行:

$dataProvider = new CActiveDataProvider('VillageSlaveM', $criteria);

$dataProvider = new CActiveDataProvider('VillageSlaveM', array('criteria'=>$criteria));

我不确定,但documentation描述了CActiveDataProvider的构造。