YII Auth multiple connection

i have multiple database and database have same table and all working fine. but how to change dynamic connection in auth modules. i had used session and state in config/main.php but dosent work.




//$a = Yii::app()->user->getState('fulldb') <<not working

//$a = Yii::app()->session['var'] = '2'; <<not working too

//$a = 2; // it work but i want dynamic and $a is based on user login


return array(

'components'=>array('authManager' => array(

            'class' => 'CDbAuthManager',

            'connectionID' => 'dbadvert'.$a, //<--how to change dynamic

            'behaviors' => array(

                'auth' => array(

                    'class' => 'auth.components.AuthBehavior',

                ),

            ),  

            'assignmentTable' => 'tbl_auth_assignment',

            'itemTable' => 'tbl_auth_item',

            'itemChildTable' => 'tbl_auth_item_child',

        ),




//multiple database connection works fine

        'db' => require(dirname(__FILE__).'/databaseUser.php'),

        'dbadvert' => require(dirname(__FILE__).'/database1.php'),

        'dbadvert2' => require(dirname(__FILE__).'/database2.php'),

}



On your current model (acording to your code) place this function




public function getDbConnection()

{

      return Yii::app()->dbadvert;

}



and keeping all the same way (including tableName function)run your app.

Good luck eotz