Commit 6992cc2c by Qiang Xue

Fixes #1196.

parent 42a58870
...@@ -115,11 +115,16 @@ class Generator extends \yii\gii\Generator ...@@ -115,11 +115,16 @@ class Generator extends \yii\gii\Generator
*/ */
public function autoCompleteData() public function autoCompleteData()
{ {
return [ $db = $this->getDbConnection();
'tableName' => function () { if ($db === null) {
return $this->getDbConnection()->getSchema()->getTableNames(); return [
}, 'tableName' => function () use ($db) {
]; return $db->getSchema()->getTableNames();
},
];
} else {
return [];
}
} }
/** /**
......
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