Пример #1
0
 private function __construct()
 {
     $dbConnectionFile = Env::path('config') . 'database.yml';
     $this->dbConnectionHash = new Env($dbConnectionFile);
     $dsn = $this->getDsn();
     try {
         $this->dbh = new PDO($dsn, $this->dbConnectionHash->get('development.user'), $this->dbConnectionHash->get('development.password'));
         $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
Пример #2
0
 private function setErrorReporting()
 {
     error_reporting(E_ALL);
     if ($this->env->get('defaults.environment') == 'development') {
         ini_set('display_errors', 'On');
     } else {
         ini_set('display_errors', 'Off');
         ini_set('log_errors', 'On');
         ini_set('error_log', implode(DIRECTORY_SEPARATOR, [Env::path(), 'tmp', 'logs', 'error.log']));
     }
 }