CListView with CActiveRecord->findAllBySql

Is it possible to use CActiveRecord’s findAllBySql to create a dataProvider object to feed into CListView or CGridView? I understand that it is possible to use CActiveDataProvider to create the dataProvider object, but I prefer to work directly with raw SQL as I find it easier to read/understand/optimise when I can read the SQL code directly. So I am wondering if Yii provides a way to create a dataProvider object directly using SQL code via a method like findAllBySQL, which can then be passed to CListView/CGridView.

I’ve searched through Google, Stackoverflow, and the Yii forums, but haven’t had much luck finding an answer to this.

Great if someone can point me in the right direction, if one exists.

Many thanks!

CSqlDataProvider. But you will not have ActiveRecords anymore, so you probably need to update your CListView itemView accordingly ($data[‘name’] instead $data->name).