Example #1
0
 /**
  * @return Database\Connection
  */
 public static function GetConnection()
 {
     if (is_null(self::$connection)) {
         // Connect to database
         $credentials = \App\Config\Database::GetData();
         self::$connection = new Database\Connection($credentials['dsn'], $credentials['username'], $credentials['password'], isset($credentials['options']) ? $credentials['options'] : null);
         // Set exceptions error mode
         self::$connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     }
     return self::$connection;
 }