예제 #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;
 }
예제 #2
0
 /**
  * Passes calls through to the Connection Schema object.
  *
  * @param   string  The method name
  * @param   array   The method parameters sent
  * @return  mixed   The result of the call
  */
 public static function __callStatic($method, $parameters)
 {
     return call_user_func_array(array(Database\Connection::get()->getSchemaBuilder(), $method), $parameters);
 }