/** * Initializes the PDO-Object, used for Database-Queries * * triggers an error when */ private function initDatabaseConnections() { try { $connector = new DBConnect(); $connector->initDatabaseFromXML(); $this->_pdo = $connector->getPdo(); $this->_em = $connector->getDoctrineEntityManager(); $this->_pdo->query('SET @activeSchoolyear := (SELECT ID FROM SystemSchoolyears WHERE active = "1" LIMIT 1); '); } catch (PDOException $e) { echo $e->getMessage(); die("Sorry, could not connect to the database with pdo."); } }
/** * Initializes the PDO-Object, used for Database-Queries * * triggers an error when the PDO-Object could not be created */ private function initDatabaseConnections() { try { $connector = new DBConnect(); $connector->initDatabaseFromXML(); $this->_pdo = $connector->getPdo(); $this->_em = $connector->getDoctrineEntityManager(); $this->_pdo->query('SET @activeSchoolyear := (SELECT ID FROM SystemSchoolyears WHERE active = "1");'); } catch (Exception $e) { trigger_error('Could not create the PDO-Object!'); } }