Problem With Multiple Database In Yii

Hi All,

I am planning to create an application that will write to two databases. Transaction that is flag as internal will be written to "db_internal" while transaction that is flag as external will be written to default "db".

For the model, one that is using default "db" called Transaction and one that use "db_internal" called TransactionExt where TransactionExt extends Transaction and only have one method, override the connectionId() method.

To make everything easier, I used this extension, multiactiverecord

Everything is working as expected but, somehow, when the connection to "db_internal" is broken, why the TransactionEx is using the "db", I am expecting error message is shown…



You should overload the getDbConnection() method in your models.

Hi nineinchnick,

Thank you for your reply.

What is the difference of getDbConnection() with connectionId() ? I have override the conenctionId.