eee
This commit is contained in:
@@ -121,9 +121,9 @@ class Gii
|
|||||||
$this->tableName = $input->getOption('table');
|
$this->tableName = $input->getOption('table');
|
||||||
}
|
}
|
||||||
return match ($make) {
|
return match ($make) {
|
||||||
'controller' => $this->getTable(1, 0),
|
'controller' => $this->getTable($input, 1, 0),
|
||||||
'model' => $this->getTable(0, 1),
|
'model' => $this->getTable($input, 0, 1),
|
||||||
default => [],
|
default => [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ class Gii
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getTable($controller, $model): array
|
private function getTable($input, $controller, $model): array
|
||||||
{
|
{
|
||||||
$tables = $this->getFields($this->getTables());
|
$tables = $this->getFields($this->getTables());
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
@@ -146,10 +146,10 @@ class Gii
|
|||||||
foreach ($tables as $key => $val) {
|
foreach ($tables as $key => $val) {
|
||||||
$data = $this->createModelFile($key, $val);
|
$data = $this->createModelFile($key, $val);
|
||||||
if ($controller == 1) {
|
if ($controller == 1) {
|
||||||
$fileList[] = $this->generateController($data);
|
$fileList[] = $this->generateController($input, $data);
|
||||||
}
|
}
|
||||||
if ($model == 1) {
|
if ($model == 1) {
|
||||||
$fileList[] = $this->generateModel($data);
|
$fileList[] = $this->generateModel($input, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $fileList;
|
return $fileList;
|
||||||
@@ -217,7 +217,7 @@ class Gii
|
|||||||
private function showAll(): array
|
private function showAll(): array
|
||||||
{
|
{
|
||||||
$res = [];
|
$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)) {
|
if (empty($_tables)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use Kiri;
|
|||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +35,7 @@ class GiiCommand extends Command
|
|||||||
->addOption('make', 'm', InputArgument::OPTIONAL)
|
->addOption('make', 'm', InputArgument::OPTIONAL)
|
||||||
->addOption('table', 't', InputArgument::OPTIONAL)
|
->addOption('table', 't', InputArgument::OPTIONAL)
|
||||||
->addOption('database', 'd', InputArgument::OPTIONAL)
|
->addOption('database', 'd', InputArgument::OPTIONAL)
|
||||||
|
->addOption('all-table', null, InputOption::VALUE_NONE, 'is run daemonize')
|
||||||
->setDescription('php kiri.php sw:gii --table u_user --database users --make model');
|
->setDescription('php kiri.php sw:gii --table u_user --database users --make model');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user