How to get model data like array

$criteria=new CDbCriteria;


$criteria->condition='employee_id=:employeeID AND group_id=:groupID AND lev=:lev';


return self::model()->findAll($criteria);

method findAll return a object array,dose it has a way can make object array to normal array just like $data[0]=1;$data[1]=2;


CActiveRecord implements (via CModel) ArrayAccess, so if $data is the result of findAll() the following two lines are equivalent:

echo $data[0]->employee_id;

echo $data[0]['employee_id'];

Is that what you mean?



model() method returns Returns the static model of the specified CActiveRecord class.

Check CActiveRecord properties… "attributes"

Solved here and here.

Here is my problem in rights module.

$data = array();

                    $sql = "SELECT * FROM authitem WHERE created_by =".Yii::app()->user->id;

                    $dbCommand = Yii::app()->db->createCommand($sql);

                    $data = $dbCommand->queryAll();

This gives me normal array but i want model array of authitem. is there any solution?

queryOne() is best used when only the first row of result is needed for a query.