Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
Dariusz Jaski | 1920374639 | |
Dariusz Jaski | 1c886fb385 | |
Dariusz Jaski | b9d1d1601a | |
Dariusz Jaski | 3f9758c403 | |
Dariusz Jaski | 661406db67 | |
Dariusz Jaski | 9c6c34f870 | |
Dariusz Jaski | a026facb7c | |
Dariusz Jaski | 3c43612503 | |
Dariusz Jaski | d32c7a0b92 | |
Dariusz Jaski | d9da5559c5 | |
Dariusz Jaski | afc2b5a261 | |
Dariusz Jaski | 54113fffc0 | |
Michal Sieciechowicz | 9204f70e50 | |
Michal Sieciechowicz | a3d8bb6131 | |
Michal Sieciechowicz | a3d71c7bc5 | |
Michal Sieciechowicz | a3c38a27c7 |
|
@ -7,5 +7,4 @@ use Fufle\ORM\Database\Credentials;
|
|||
interface IConnector {
|
||||
public function getConnectionString(Credentials $credentials);
|
||||
public function driverEquals(string $driver);
|
||||
public static function Connect(string $host, int $port, string $database, string $user, string $password);
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
namespace Fufle\ORM\Database\Connectors;
|
||||
|
||||
use Fufle\ORM\Database\Credentials;
|
||||
use Fufle\ORM\Database\ConnectionManager;
|
||||
|
||||
class PostgresConnector implements IConnector {
|
||||
public function getConnectionString(Credentials $c) {
|
||||
|
@ -12,9 +11,4 @@ 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);
|
||||
}
|
||||
}
|
|
@ -2,21 +2,20 @@
|
|||
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',
|
||||
];
|
||||
PostgresConnector::Connect(...$params);
|
||||
//ConnectionManager::RegisterConnector(new PostgresConnector());
|
||||
//ConnectionManager::Connect(...$params);
|
||||
ConnectionManager::RegisterConnector(new PostgresConnector());
|
||||
ConnectionManager::Connect(...$params);
|
||||
echo "
|
||||
|
||||
";
|
||||
|
|
Loading…
Reference in New Issue