Using multiple databases connections in models

something like this , that allows you to set the db in an AR, would be nice to have in the core in the near future

It allows you to define a variable in the model to use a different database

Something like




class User extends CModel{

   public function connectionId(){return 'db2';}

}



would use "db2" database connection

It would only add to the framework, without modifying its essence

http://www.yiiframework.com/wiki/123/multiple-database-support-in-yii/

Yeah, yeah i know

check out the link i posted

Its an extension I’ve made after read the tutorial link you sent

The extension also comes with support for different connections in gii model creator

What i mean was that it would be nice to add something like that in the core

for example, in my extension

the method ‘connectionId’ returns by default ‘db’, and you can overwrite it in your model to use a different one, returning a different database connection component

It only adds default functionalities to the framework’s core

and to add multiple database support for gii you just need to change a couple of lines and will save peoples time

please check out the extension file

Anyway, just my suggestion