From fbf2aaae0737b239333e8bd31900c168e839e80d Mon Sep 17 00:00:00 2001 From: Dariusz Date: Sun, 7 Mar 2021 11:30:13 +0100 Subject: [PATCH] 0.2.3 --- src/Fufle/ORM/Database/Connectors/PostgresConnector.php | 5 +++++ tests/ModelTests.php | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Fufle/ORM/Database/Connectors/PostgresConnector.php b/src/Fufle/ORM/Database/Connectors/PostgresConnector.php index fec017f..046be98 100644 --- a/src/Fufle/ORM/Database/Connectors/PostgresConnector.php +++ b/src/Fufle/ORM/Database/Connectors/PostgresConnector.php @@ -11,4 +11,9 @@ class PostgresConnector implements IConnector { public function driverEquals(string $driver) { return $driver === 'pgsql'; } + + public static function Connect(string $host, int $port, string $database, string $user, string $password) { + ConnectionManager::RegisterConnector(new PostgresConnector()); + ConnectionManager::Connect('pgsql', $host, $port, $database, $user, $password); + } } \ No newline at end of file diff --git a/tests/ModelTests.php b/tests/ModelTests.php index cbee908..9028c9d 100644 --- a/tests/ModelTests.php +++ b/tests/ModelTests.php @@ -2,20 +2,21 @@ require_once __DIR__ . '/../vendor/autoload.php'; use Fufle\Demo\Model\Job; -use Fufle\ORM\Database\ConnectionManager; +//use Fufle\ORM\Database\ConnectionManager; use Fufle\ORM\Database\Connectors\PostgresConnector; //$dns = 'pgsql:host=localhost;port=5432;dbname=dynamic;user=dynamic;password=password123'; $params = [ - 'pgsql', +// 'pgsql', 'localhost', 5432, 'dynamic_dev', 'dynamic', 'Pass@Dyna21', ]; -ConnectionManager::RegisterConnector(new PostgresConnector()); -ConnectionManager::Connect(...$params); +PostgresConnector::Connect(...$params); +//ConnectionManager::RegisterConnector(new PostgresConnector()); +//ConnectionManager::Connect(...$params); echo " ";