This commit is contained in:
2021-08-16 18:24:32 +08:00
parent 863ef72c00
commit 51b0212527
3 changed files with 18 additions and 98 deletions
+4 -2
View File
@@ -4,13 +4,13 @@ declare(strict_types=1);
namespace Kiri\Pool;
use Closure;
use Database\Mysql\PDO;
use Exception;
use HttpServer\Http\Context;
use Kiri\Abstracts\Component;
use Kiri\Kiri;
use Swoole\Error;
use Throwable;
use Database\Mysql\PDO;
/**
* Class Connection
@@ -105,7 +105,9 @@ class Connection extends Component
public function create($coroutineName, $config): Closure
{
return static function () use ($coroutineName, $config) {
return new PDO($config['database'], $config['cds'], $config['username'], $config['password'], $config['charset'] ?? 'utf8mb4');
return Kiri::getDi()->newObject(PDO::class, [
$config['database'], $config['cds'], $config['username'], $config['password'], $config['charset'] ?? 'utf8mb4'
]);
};
}