This commit is contained in:
xl
2024-09-03 14:47:29 +08:00
parent 8d5e8c4b3f
commit d84ddd23c8
2 changed files with 9 additions and 7 deletions
+7 -7
View File
@@ -121,9 +121,9 @@ class Gii
$this->tableName = $input->getOption('table');
}
return match ($make) {
'controller' => $this->getTable(1, 0),
'model' => $this->getTable(0, 1),
default => [],
'controller' => $this->getTable($input, 1, 0),
'model' => $this->getTable($input, 0, 1),
default => [],
};
}
@@ -135,7 +135,7 @@ class Gii
*
* @throws Exception
*/
private function getTable($controller, $model): array
private function getTable($input, $controller, $model): array
{
$tables = $this->getFields($this->getTables());
if (empty($tables)) {
@@ -146,10 +146,10 @@ class Gii
foreach ($tables as $key => $val) {
$data = $this->createModelFile($key, $val);
if ($controller == 1) {
$fileList[] = $this->generateController($data);
$fileList[] = $this->generateController($input, $data);
}
if ($model == 1) {
$fileList[] = $this->generateModel($data);
$fileList[] = $this->generateModel($input, $data);
}
}
return $fileList;
@@ -217,7 +217,7 @@ class Gii
private function showAll(): array
{
$res = [];
$_tables = Db::connect($this->db)->fetchAll('SHOW TABLES FROM `' . $this->db->database . '`');
$_tables = Db::connect($this->db)->fetchAll('SHOW TABLES FROM `' . $this->db->database . '`');
if (empty($_tables)) {
return $res;
}