From bf26d7b44035722f21b6af13c098f1bb2720eb63 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 24 Jun 2021 01:57:39 +0200 Subject: Set Database attribute in Application class --- core/application.php | 13 ------------- core/namespace/Application.php | 14 +++++++++++++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/core/application.php b/core/application.php index e4c481f..21ab203 100644 --- a/core/application.php +++ b/core/application.php @@ -141,19 +141,6 @@ require 'functions.php'; $Language = Application::getLanguage(); $Database = Application::getDatabase(); -#=============================================================================== -# Set Database attributes -#=============================================================================== -$Database->setAttribute( - $Database::ATTR_DEFAULT_FETCH_MODE, - $Database::FETCH_ASSOC -); - -$Database->setAttribute( - $Database::ATTR_ERRMODE, - $Database::ERRMODE_EXCEPTION -); - #=============================================================================== # Check if "304 Not Modified" and ETag header should be sent #=============================================================================== diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 1597801..3cecf3b 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -44,7 +44,19 @@ class Application { $username = self::get('DATABASE.USERNAME'); $password = self::get('DATABASE.PASSWORD'); - self::$Database = new Database($hostname, $basename, $username, $password); + $Database = new Database($hostname, $basename, $username, $password); + + $Database->setAttribute( + $Database::ATTR_DEFAULT_FETCH_MODE, + $Database::FETCH_ASSOC + ); + + $Database->setAttribute( + $Database::ATTR_ERRMODE, + $Database::ERRMODE_EXCEPTION + ); + + self::$Database = $Database; } return self::$Database; -- cgit v1.2.3