Continued:
[core.git] / framework / bootstrap / class_FrameworkBootstrap.php
index cb8aaffde3a6b2eb0e4cd97058eb93becc9f8752..26c419daf0dc42f1a124627a896c3e919e968338 100644 (file)
@@ -68,6 +68,11 @@ final class FrameworkBootstrap {
         */
        private static $configurationInstance = NULL;
 
+       /**
+        * Database instance
+        */
+       private static $databaseInstance = NULL;
+
        /*
         * Includes applications may have. They will be tried in the given order,
         * some will become soon deprecated.
@@ -117,24 +122,6 @@ final class FrameworkBootstrap {
                return self::$configurationInstance;
        }
 
-       /**
-        * Getter for request instance
-        *
-        * @return      $requestInstance        An instance of a Requestable class
-        */
-       public static function getRequestInstance () {
-               return self::$requestInstance;
-       }
-
-       /**
-        * Getter for response instance
-        *
-        * @return      $responseInstance       An instance of a Responseable class
-        */
-       public static function getResponseInstance () {
-               return self::$responseInstance;
-       }
-
        /**
         * "Getter" to get response/request type from analysis of the system.
         *
@@ -398,7 +385,7 @@ final class FrameworkBootstrap {
                $applicationInstance = ApplicationHelper::getSelfInstance();
 
                // Is the database instance already set?
-               if ($applicationInstance->getDatabaseInstance() instanceof DatabaseConnector) {
+               if (self::getDatabaseInstance() instanceof DatabaseConnector) {
                        // Yes, then abort here
                        throw new BadMethodCallException('Method called twice.');
                } // END - if
@@ -410,7 +397,7 @@ final class FrameworkBootstrap {
                $connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance);
 
                // Set it in application helper
-               $applicationInstance->setDatabaseInstance($connectionInstance);
+               self::setDatabaseInstance($connectionInstance);
        }
 
        /**
@@ -656,6 +643,25 @@ final class FrameworkBootstrap {
                self::getConfigurationInstance()->setConfigEntry('detected_full_app_path', $applicationPath);
                self::getConfigurationInstance()->setConfigEntry('detected_app_name'     , $application);
        }
+
+       /**
+        * Getter for request instance
+        *
+        * @return      $requestInstance        An instance of a Requestable class
+        */
+       public static function getRequestInstance () {
+               return self::$requestInstance;
+       }
+
+       /**
+        * Getter for response instance
+        *
+        * @return      $responseInstance       An instance of a Responseable class
+        */
+       public static function getResponseInstance () {
+               return self::$responseInstance;
+       }
+
        /**
         * Setter for request instance
         *
@@ -676,4 +682,24 @@ final class FrameworkBootstrap {
                self::$responseInstance = $responseInstance;
        }
 
+       /**
+        * Setter for database instance
+        *
+        * @param       $databaseInstance       An instance of a DatabaseConnection class
+        * @return      void
+        */
+       public static function setDatabaseInstance (DatabaseConnection $databaseInstance) {
+               self::$databaseInstance = $databaseInstance;
+       }
+
+       /**
+        * Getter for database instance
+        *
+        * @return      $databaseInstance       An instance of a DatabaseConnection class
+        */
+       public static function getDatabaseInstance () {
+               // Return instance
+               return self::$databaseInstance;
+       }
+
 }