改名
This commit is contained in:
+11
-1
@@ -5,6 +5,7 @@ namespace Gii;
|
|||||||
|
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Snowflake\Abstracts\Config;
|
||||||
use Snowflake\Abstracts\Input;
|
use Snowflake\Abstracts\Input;
|
||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
@@ -32,7 +33,16 @@ class Command extends \Console\Command
|
|||||||
/** @var Gii $gii */
|
/** @var Gii $gii */
|
||||||
$gii = Snowflake::app()->get('gii');
|
$gii = Snowflake::app()->get('gii');
|
||||||
|
|
||||||
return $gii->run($dtl->get('databases'), $dtl);
|
$connections = Snowflake::app()->db;
|
||||||
|
if ($dtl->exists('databases')) {
|
||||||
|
return $gii->run($connections->get($dtl->get('databases')), $dtl);
|
||||||
|
}
|
||||||
|
|
||||||
|
$array = [];
|
||||||
|
foreach (Config::get('databases') as $key => $connection) {
|
||||||
|
$array[$key] = $gii->run($connections->get($key), $dtl);
|
||||||
|
}
|
||||||
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-15
@@ -111,24 +111,13 @@ class Gii
|
|||||||
*/
|
*/
|
||||||
private function getModel($make, $input): array
|
private function getModel($make, $input): array
|
||||||
{
|
{
|
||||||
if ($this->db) {
|
if ($this->db instanceof Connection) {
|
||||||
return $this->makeByDatabases($make, $input);
|
return $this->makeByDatabases($make, $input);
|
||||||
}
|
}
|
||||||
if ($this->input->exists('databases')) {
|
$db = $this->input->get('databases', 'db');
|
||||||
$db = $this->input->get('databases', 'db');
|
$this->db = Snowflake::app()->db->get($db);
|
||||||
$this->db = Snowflake::app()->db->get($db);
|
|
||||||
|
|
||||||
return $this->makeByDatabases($make, $input);
|
return $this->makeByDatabases($make, $input);
|
||||||
}
|
|
||||||
$array = [];
|
|
||||||
foreach (Config::get('databases') as $key => $connection) {
|
|
||||||
var_dump($connection);
|
|
||||||
|
|
||||||
$this->db = Snowflake::app()->db->get($key);
|
|
||||||
|
|
||||||
$array[$key] = $this->makeByDatabases($make, $input);
|
|
||||||
}
|
|
||||||
return $array;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user