<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=name',
'username' => 'login',
'password' => 'password',
'charset' => 'utf8',
],
],
];
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=name',
'username' => 'login',
'password' => 'password',
'charset' => 'utf8',
],
'db2' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;dbname=db2',
'username' => 'user',
'password' => 'pass',
'charset' => 'utf8',
],
];
public static function getDb()
{
return Yii::$app->db2;
}