src/Factory.php
public static function getDbo()
	{
		if (!self::$database)
		{
			//get config values

			$host = Config::get()->get('database.host');
			$user = Config::get()->get('database.user');
			$password = Config::get()->get('database.password');
			$database = Config::get()->get('database.name');
			$prefix = Config::get()->get('database.prefix');
			$driver = Config::get()->get('database.driver');
			$debug = Config::get()->get('database.debug');

			//added extra code to prevent error when $driver is incorrect

			$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);

			self::$database = DatabaseFactory::getInstance()->getDriver($driver, $options);

			//get the debug configuration setting
			self::$database->setDebug(Config::get()->get('debug'));
		}
		return self::$database;
	}
public static function getDbo()
	{
		if (!self::$database)
		{
			//get config values

			$host = Config::get()->get('database.host');
			$user = Config::get()->get('database.user');
			$password = Config::get()->get('database.password');
			$database = Config::get()->get('database.name');
			$prefix = Config::get()->get('database.prefix');
			$driver = Config::get()->get('database.driver');
			$debug = Config::get()->get('database.debug');

			//added extra code to prevent error when $driver is incorrect

			$options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);

			self::$database = DatabaseFactory::getInstance()->getDriver($driver, $options);

			//get the debug configuration setting
			self::$database->setDebug(Config::get()->get('debug'));
		}
		return self::$database;
	}
public static function getDbo ( ) { if ( ! self :: $ database ) { //get config values $ host = Config :: get ( ) -> get ( 'database.host' ) ; $ user = Config :: get ( ) -> get ( 'database.user' ) ; $ password = Config :: get ( ) -> get ( 'database.password' ) ; $ database = Config :: get ( ) -> get ( 'database.name' ) ; $ prefix = Config :: get ( ) -> get ( 'database.prefix' ) ; $ driver = Config :: get ( ) -> get ( 'database.driver' ) ; $ debug = Config :: get ( ) -> get ( 'database.debug' ) ; //added extra code to prevent error when $driver is incorrect $ options = array ( 'driver' => $ driver , 'host' => $ host , 'user' => $ user , 'password' => $ password , 'database' => $ database , 'prefix' => $ prefix ) ; self :: $ database = DatabaseFactory :: getInstance ( ) -> getDriver ( $ driver , $ options ) ; //get the debug configuration setting self :: $ database -> setDebug ( Config :: get ( ) -> get ( 'debug' ) ) ; } return self :: $ database ; }
Get a database object.

Returns the global {@link Driver} object, only creating it if it doesn't already exist.

@return  DatabaseDriver
Get a database object .