Tuesday, February 1, 2022

[FIXED] Using Multiple Database Connection Not Working For Extension

Issue

I am doing multiple database connection using the tutorial at http://www.yiiframework.com/wiki/544/multiple-database-connection-select-database-based-on-login-user-id-dynamic/ . The code is working fine in the model. But the problem is I am using an extension where I am using db connection using Yii::app()->db; Here I am getting exception Property "CWebApplication.dbadvert" is not defined. The controller of the extension is extended from CExtController. Please help.


Solution

I wrote the query for the extension in a model as functions. and in the CExtController created an instance of the model. Then I called those functions and everything is working fine.



Answered By - Akhilesh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.