models to activedataprovider

Hi there!

how can i make a cactivedataprovider of the following line?

$models = Hotel::model()->findAllByPk($pkArray);

thanks a lot!

This should work:

$provider = new CActiveDataProvider(‘Hotel’);


or modify the following:

$dataProvider=new CActiveDataProvider('Post', array(



        'order'=>'create_time DESC',







yesssss thanks :)

oh and i am just wondering, what’s the best way to pass an array of pk’s to a cdbcriteria? can it be done without a foreach loop?

Create a CDbCriteria first, and use $criteria->addInCondition(‘id’,$values). You can then pass this to the data provider :)