DAO and Query builder instead of Active Record

I would like to know how I can create models based on DAO and Query builder instead of Active Records.

I believe the controllers and view files will also be different for them.

I would like to create a complete application or at least a part of my application in Dao or Query builder as it has to return huge amounts of data

How can I go about achieving this,

Is there a tutorial or complete example anywhere, I have bits and pieces here and there but have not been able to put it together/

I am very new to yii and new to mvc as well

You can always start with creating ActiveRecords for all your tables. That way you have easy, generic access to all your database tables through the convenient AR methods. Then you can spice up these models with extra methods. For example:

public function queryExtremelyComplexData($param)


    return Yii::app()->db->createCommand(/* extremely complex SQL */)->queryAll();


This way you get the best of both worlds.

Yes that is a good idea,

Is there any demo or tutorial where both Dao or Query builder are used alongwith Ar

Any other ideas are also welcome