改名
This commit is contained in:
+12
-1
@@ -108,6 +108,17 @@ class Connection extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $config
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function configure($config): static
|
||||||
|
{
|
||||||
|
Kiri::configure($this, $config);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -141,7 +152,7 @@ class Connection extends Component
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getSchema(): Schema
|
public function getSchema(): Schema
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ namespace Database;
|
|||||||
|
|
||||||
use Annotation\Inject;
|
use Annotation\Inject;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Server\Events\OnWorkerStart;
|
|
||||||
use Kiri\Abstracts\Config;
|
use Kiri\Abstracts\Config;
|
||||||
use Kiri\Abstracts\Providers;
|
use Kiri\Abstracts\Providers;
|
||||||
use Kiri\Application;
|
use Kiri\Application;
|
||||||
use Kiri\Events\EventProvider;
|
use Kiri\Events\EventProvider;
|
||||||
use Kiri\Exception\ConfigException;
|
use Kiri\Exception\ConfigException;
|
||||||
use Kiri\Kiri;
|
use Kiri\Kiri;
|
||||||
|
use Server\Events\OnWorkerStart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DatabasesProviders
|
* Class DatabasesProviders
|
||||||
@@ -53,11 +53,9 @@ class DatabasesProviders extends Providers
|
|||||||
*/
|
*/
|
||||||
public function get($name): Connection
|
public function get($name): Connection
|
||||||
{
|
{
|
||||||
$application = Kiri::app();
|
$config = $this->_settings($this->getConfig($name));
|
||||||
if (!$application->has('databases.' . $name)) {
|
|
||||||
$application->set('databases.' . $name, $this->_settings($this->getConfig($name)));
|
return Kiri::getDi()->get(Connection::class)->configure($config);
|
||||||
}
|
|
||||||
return $application->get('databases.' . $name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,12 +69,10 @@ class DatabasesProviders extends Providers
|
|||||||
if (empty($databases)) {
|
if (empty($databases)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$application = Kiri::app();
|
$connection = Kiri::getDi()->get(Connection::class);
|
||||||
foreach ($databases as $name => $database) {
|
foreach ($databases as $database) {
|
||||||
/** @var Connection $connection */
|
/** @var Connection $connection */
|
||||||
$application->set('databases.' . $name, $this->_settings($database));
|
$connection->configure($database)->fill();
|
||||||
$database = $application->get('databases.' . $name);
|
|
||||||
$database->fill();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ class Columns extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $column
|
* @param array $column
|
||||||
* @param $table
|
* @param $table
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user