/** * @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; }
public function __construct($database, $table = null) { $this->database = $database; $this->table = $table; $this->manager = Manager::getInstance(Config\Database::conf()); }