Reputation: 1727
I have 15 database connections defined in my config file . Depending up on the user connection I connect to the corresponding database .
I can check user selection in SWITCH condition and can connect to the corresponding database .
But thinking is there any way I can do some thing like below
$connection = Yii::app()->{$this->my_dbselection};
Here I am trying to replace connection name with variable .But not finding the correct syntax for it .
Thanks
Upvotes: 0
Views: 38
Reputation: 1727
Whatever I mentioned in the question worked for me .
$connection = Yii::app()->{$this->my_dbselection};
Upvotes: 1