Skip to content

Commit d3b532c

Browse files
SilverFiresamdark
authored andcommitted
Pass DB to Yii application as early as possible (#4601)
This commit fixes issue reported in Yii2 repo yiisoft/yii2-app-advanced#221
1 parent 6ae89db commit d3b532c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Codeception/Lib/Connector/Yii2.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public function startApp()
6666
if (!isset($config['class'])) {
6767
$config['class'] = 'yii\web\Application';
6868
}
69+
if (static::$db) {
70+
// If the DB conection already exists, make sure to pass it as early as possible
71+
// to prevent application from new connection creating during bootstrap
72+
$config['components']['db'] = static::$db;
73+
}
6974
/** @var \yii\web\Application $app */
7075
$this->app = Yii::createObject($config);
7176
$this->persistDb();

0 commit comments

Comments
 (0)