Esempio n. 1
0
 /**
  * Get database connection
  *
  * @return \PDO
  * @throws \Exception
  */
 protected function getDbConnection()
 {
     if (is_null($this->dbConnection)) {
         $dbParameters = $this->_getDatabaseConnectionParameters();
         if (!is_array($dbParameters)) {
             throw new \Exception('No valid database connection parameters found');
         }
         $this->dbConnection = \Zettr\DbConnection::getConnection($dbParameters);
     }
     return $this->dbConnection;
 }
Esempio n. 2
0
 /**
  * Apply settings to current environment
  *
  * @throws \Exception
  * @return bool
  */
 public function apply()
 {
     foreach ($this->handlerCollection as $handler) {
         /* @var $handler Handler\HandlerInterface */
         $res = $handler->apply();
         if (!$res) {
             throw new \Exception('Error in handler: ' . $handler->getLabel());
         }
     }
     DbConnection::commitAllTransactions();
     return true;
 }