Merge pull request #1761 from lucianobaraglia/master
Basic app: DB configuration in separated file
This commit is contained in:
commit
d35698afe6
@ -3,6 +3,8 @@
|
|||||||
Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
|
Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
|
||||||
|
|
||||||
$params = require(__DIR__ . '/params.php');
|
$params = require(__DIR__ . '/params.php');
|
||||||
|
$db = require(__DIR__ . '/db.php');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => 'basic-console',
|
'id' => 'basic-console',
|
||||||
'basePath' => dirname(__DIR__),
|
'basePath' => dirname(__DIR__),
|
||||||
@ -22,13 +24,7 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'db' => [
|
'db' => $db,
|
||||||
'class' => 'yii\db\Connection',
|
|
||||||
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
|
|
||||||
'username' => 'root',
|
|
||||||
'password' => '',
|
|
||||||
'charset' => 'utf8',
|
|
||||||
],
|
|
||||||
'fixture' => [
|
'fixture' => [
|
||||||
'class' => 'yii\test\DbFixtureManager',
|
'class' => 'yii\test\DbFixtureManager',
|
||||||
'basePath' => '@tests/unit/fixtures',
|
'basePath' => '@tests/unit/fixtures',
|
||||||
|
9
config/db.php
Normal file
9
config/db.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'class' => 'yii\db\Connection',
|
||||||
|
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '',
|
||||||
|
'charset' => 'utf8',
|
||||||
|
];
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$params = require(__DIR__ . '/params.php');
|
$params = require(__DIR__ . '/params.php');
|
||||||
|
$db = require(__DIR__ . '/db.php');
|
||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
'id' => 'basic',
|
'id' => 'basic',
|
||||||
@ -29,13 +30,7 @@ $config = [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'db' => [
|
'db' => $db,
|
||||||
'class' => 'yii\db\Connection',
|
|
||||||
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
|
|
||||||
'username' => 'root',
|
|
||||||
'password' => '',
|
|
||||||
'charset' => 'utf8',
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
'params' => $params,
|
'params' => $params,
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user