*/
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.
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.
*
$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
$connectionInstance = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getSelfInstance(), $databaseInstance);
// Set it in application helper
- $applicationInstance->setDatabaseInstance($connectionInstance);
+ self::setDatabaseInstance($connectionInstance);
}
/**
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
*
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;
+ }
+
}