Exemplo n.º 1
0
 /**
  * Apply settings to current environment
  *
  * @throws Exception
  * @return bool
  */
 public function apply()
 {
     $this->handlerCollection->buildFromSettingsCSVFile($this->settingsFilePath, $this->environment, 'DEFAULT', $this->groups, $this->excludeGroups);
     foreach ($this->handlerCollection as $handler) {
         /* @var $handler Est_Handler_Abstract */
         $res = $handler->apply();
         if (!$res) {
             throw new Exception('Error in handler: ' . $handler->getLabel());
         }
     }
     Est_DbConnection::commitAllTransactions();
     return true;
 }
Exemplo n.º 2
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');
         }
         foreach (array('host', 'database', 'username') as $key) {
             if (!isset($dbParameters[$key]) || empty($dbParameters[$key])) {
                 throw new Exception(sprintf('No "%s" found in database connection parameters', $key));
             }
         }
         $this->dbConnection = Est_DbConnection::getConnection($dbParameters);
     }
     return $this->dbConnection;
 }