/** * Creates a database instance and registers autoload * @param array $config */ public function __construct(array $config) { $this->_config = $config; require 'Autoloader/Autoloader.php'; spl_autoload_register(array('Autoloader\\Autoloader', 'load')); Database::getInstance($config['database']); }
/** * Execute a PDOStatement and throws an exception in case of any error * * @param \PDOStatement $st * @throws \Exception */ private function _execute(\PDOStatement $st) { if (!$st->execute()) { $this->_db->rollBack(); $error = $st->errorInfo(); throw new \Exception('Error trying to execute query "' . $st->queryString . '": ' . $error[2]); } }