Can you get CActiveRecord instances back from executing plain SQL query? how?

Hi, I’m using CDbConnection::createCommand() to execute a plain SQL query and get back an SQL result.

I would like to get CActiveRecord instances, is that possible? even with associated models? If so, how?

I already searched for this on google and in the documentation but couldn’t find it.

Thanks.

Would be something like this?




Model::findBySql($sql, $params)->all();



[color="#006400"]/* Moved from "2.0" to "1.1" */[/color]

http://www.yiiframework.com/doc/api/1.1/CActiveRecord#findAllBySql-detail