private function loadDatabaseFromDbParsed() { if (is_array($this->credentials)) { $this->connection = new \PDO($this->credentials['sentencePdo'], $this->credentials['user'], $this->credentials['pass']); } else { $this->connection = new \PDO($this->credentials); } $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); }
/** * Connect to DB * * @return type */ private function connect() { if ($this->pdo) { return; } $this->pdo = new PDO($this->config['dsn'], $this->config['user'], $this->config['pass']); $this->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }