I have my Yii app setup with multiple databases using this method
http://www.yiiframework.com/wiki/78/multiple-databases-and-multiple-domains/
Is it possible to use the Gii code generation with my secondary databases? How?
I have my Yii app setup with multiple databases using this method
http://www.yiiframework.com/wiki/78/multiple-databases-and-multiple-domains/
Is it possible to use the Gii code generation with my secondary databases? How?
Gii statically accesses Yii::app()->db in generators/model/ModelCode.php. You could create another gii codebase and route requests meant for the other database to it, but I can’t think of anything as dynamic as simply extending CActiveRecord to use a diff db connection.
~thinkt4nk
edit: or you could just sed s/Yii::app()->db/Yii::app()->db2/ if you just need it temporarily to build some scaffolding ^^
Thanks, Makes sense… I will probably just temporarily edit it, to point to the 2nd db.
But it would be nice if there was an option in the gii gui ![]()
You would also have to go back and change the models to extend the 2nd database’s alternative active record
I just added it to an extesion I created a while ago
Check it out here