user login select two db




      'db' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host=127.0.0.1;dbname=db1',

            'username' => 'root',

            'password' => '',

            'charset' => 'utf8',

        ],

        'db2' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host=127.0.0.1;dbname=db2',

            'username' => 'root',

            'password' => '',

            'charset' => 'utf8',

        ],



LoginForm.php




...

protected function getUser()

    {

        if ($this->_user === null) {

            $this->_user = Users::findByEmail($this->email);

            Admin::findOne(5);

        }


        return $this->_user;

    }

...



Users use db1

Admin use db2

Why not work?

Thanks

How did you configure for Users to use db1 and Admin to use db2? That is not mentioned here.