Commit cd4b3f78 by Carsten Brandt

Gii model generator did not add correct db connection

if component id is different from 'db'
parent f4c38faf
......@@ -41,6 +41,16 @@ class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') .
{
return '<?= $tableName ?>';
}
<?php if ($generator->db !== 'db'): ?>
/**
* @return \yii\db\Connection the database connection used by this AR class.
*/
public static function getDb()
{
return Yii::$app->get('<?= $generator->db ?>');
}
<?php endif; ?>
/**
* @inheritdoc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment