All my reads should go to one DB connection All my writes should go to another connection
How do I accomplish this in Yii, with minimal changing the code of the core library?
All my reads should go to one DB connection All my writes should go to another connection
How do I accomplish this in Yii, with minimal changing the code of the core library?
Just set in the main.php
'db2'=> array()...
And than in your app you can use Yii::app()->db2
For active record you should override this method
http://www.yiiframework.com/doc/api/1.1/CActiveRecord#dbConnection-detail
and return Yii::app()->db2
Here’s one Yii extension that may be useful.
/Tommy