From 459211a5d5fc1e04abbbd865a26cac507351152f Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Thu, 2 Mar 2023 12:24:31 +0100 Subject: [PATCH] Change file name so PHP Slim found the class --- Source/API/script/Config/ConnectClass.php | 34 +++++++++++++++++++++++ Source/API/script/Config/config.php | 29 ------------------- Source/API/script/Gateway/GatewayForm.php | 6 ++-- 3 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 Source/API/script/Config/ConnectClass.php delete mode 100644 Source/API/script/Config/config.php diff --git a/Source/API/script/Config/ConnectClass.php b/Source/API/script/Config/ConnectClass.php new file mode 100644 index 0000000..f1865f7 --- /dev/null +++ b/Source/API/script/Config/ConnectClass.php @@ -0,0 +1,34 @@ +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; + } + + +} diff --git a/Source/API/script/Config/config.php b/Source/API/script/Config/config.php deleted file mode 100644 index 6c17b53..0000000 --- a/Source/API/script/Config/config.php +++ /dev/null @@ -1,29 +0,0 @@ -connection = (new \Config\ConnectClass)->connect(); + $this->connection = (new ConnectClass)->connect(); }catch(PDOException $e){ throw new PDOException(); }