Change file name so PHP Slim found the class
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent b32202fc32
commit 459211a5d5

@ -0,0 +1,34 @@
<?php
namespace Config;
use PDOException;
require_once __DIR__ ."/Connection.php";
class ConnectClass{
private string $dsn;
private string $login;
private string $password;
function __construct(){
$this->dsn = "mysql:host=".$_ENV["HOST"].";dbname=".$_ENV["DATABASE"].";";
$this->login = $_ENV["USER"];
$this->password = $_ENV["PASSWORD"];
}
function connect(): int|Connection
{
try {
$connection = new Connection($this->dsn,$this->login,$this->password);
}catch (PDOException){
throw new PDOException();
}
return $connection;
}
}

@ -1,29 +0,0 @@
<?php
namespace Config;
use PDOException;
require_once __DIR__ ."/Connection.php";
class ConnectClass{
function connect(): int|Connection
{
$dsn = "mysql:host=".$_ENV["HOST"].";dbname=".$_ENV["DATABASE"].";";
$login = $_ENV["USER"];
$password = $_ENV["PASSWORD"];
try {
$connection = new Connection($dsn,$login,$password);
}catch (PDOException){
throw new PDOException();
}
return $connection;
}
}

@ -2,17 +2,19 @@
namespace Gateway;
use Config\ConnectClass;
use Config\Connection;
use PDO;
use PDOException;
class GatewayForm
{
private \Config\Connection $connection;
private Connection $connection;
public function __construct()
{
try{
$this->connection = (new \Config\ConnectClass)->connect();
$this->connection = (new ConnectClass)->connect();
}catch(PDOException $e){
throw new PDOException();
}

Loading…
Cancel
Save