This commit is contained in:
2022-09-20 11:18:00 +08:00
parent 0d8ccffddf
commit 4d3793e751
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -117,8 +117,8 @@ class Gii
*/ */
private function makeByDatabases($make, InputInterface $input): array private function makeByDatabases($make, InputInterface $input): array
{ {
if ($input->hasOption('name')) { if ($input->hasOption('table')) {
$this->tableName = $input->getOption('name'); $this->tableName = $input->getOption('table');
} }
return match ($make) { return match ($make) {
'controller' => $this->getTable(1, 0), 'controller' => $this->getTable(1, 0),
@@ -283,8 +283,8 @@ class Gii
if (in_array(strtoupper($_val['Field']), $this->keyword)) { if (in_array(strtoupper($_val['Field']), $this->keyword)) {
throw new Exception('You can not use keyword "' . $_val['Field'] . '" as field at table "' . $tableName . '"'); throw new Exception('You can not use keyword "' . $_val['Field'] . '" as field at table "' . $tableName . '"');
} }
array_push($visible, $this->createVisible($_val['Field'])); $visible[] = $this->createVisible($_val['Field']);
array_push($fields, $_val); $fields[] = $_val;
$res[] = $this->createSetFunc($_val['Field'], $_val['Comment']); $res[] = $this->createSetFunc($_val['Field'], $_val['Comment']);
} }
+4 -4
View File
@@ -38,9 +38,9 @@ class GiiCommand extends Command
$this->service = Kiri::getDi()->get(LocalService::class); $this->service = Kiri::getDi()->get(LocalService::class);
$this->setName('sw:gii') $this->setName('sw:gii')
->addOption('make', 'm', InputArgument::OPTIONAL) ->addOption('make', 'm', InputArgument::OPTIONAL)
->addOption('name', 't', InputArgument::OPTIONAL) ->addOption('table', 't', InputArgument::OPTIONAL)
->addOption('databases', 'd', InputArgument::OPTIONAL) ->addOption('database', 'd', InputArgument::OPTIONAL)
->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx'); ->setDescription('php kiri.php sw:gii --table u_user --database users --make model');
} }
@@ -55,7 +55,7 @@ class GiiCommand extends Command
try { try {
/** @var Gii $gii */ /** @var Gii $gii */
$gii = $this->service->get('gii'); $gii = $this->service->get('gii');
if (($db = $input->getOption('databases')) != null) { if (($db = $input->getOption('database')) != null) {
$gii->run($this->service->get($db), $input); $gii->run($this->service->get($db), $input);
} else { } else {
$action = $input->getOption('make'); $action = $input->getOption('make');