public function __construct() { $config = Application::getDatabaseConfig(); $dsn = 'mysql:dbname=' . $config['db_name'] . ';host=' . $config['db_host']; try { $this->dbh = new \PDO($dsn, $config['db_username'], $config['db_password']); $this->dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } catch (\PDOException $e) { $this->processingError($e); throw new \PDOException($e->getMessage()); } }