save() public method

Saves settings entities to DB
public save ( )
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     parent::save();
     if (!empty($this->_settings)) {
         $this->_settings->save();
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     $this->changed = microtime();
     if (empty($this->id)) {
         $this->createdById = $this->changedById;
         $this->added = new DateTime();
         $this->status = FARM_STATUS::TERMINATED;
         if (empty($this->settings[FarmSetting::TIMEZONE])) {
             $this->settings[FarmSetting::TIMEZONE] = date_default_timezone_get();
         }
         $this->settings[FarmSetting::CRYPTO_KEY] = \Scalr::GenerateRandomKey(40);
         /* @var $governance Governance */
         $governance = Governance::findPk($this->envId, Governance::CATEGORY_GENERAL, Governance::GENERAL_LEASE);
         if (!empty($governance) && $governance->enabled) {
             $this->settings[FarmSetting::LEASE_STATUS] = 'Active';
         }
         //TODO: unused field
         $this->region = Aws::REGION_US_EAST_1;
     }
     parent::save();
     if (!empty($this->_settings)) {
         $this->_settings->save();
     }
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     try {
         $this->db()->BeginTrans();
         parent::save();
         if (!empty($this->_properties)) {
             $this->_properties->save();
         }
         $this->db()->CommitTrans();
     } catch (Exception $e) {
         $this->db()->RollbackTrans();
         throw $e;
     }
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     $this->setupRole();
     $this->setupAlias();
     $this->setupScaling();
     $this->setupBehaviors();
     $this->setupPolling();
     parent::save();
     $this->setupAnalytics();
     if (!empty($this->_settings)) {
         $this->_settings->save();
     }
 }
Ejemplo n.º 5
0
Archivo: Farm.php Proyecto: scalr/scalr
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     $this->changed = microtime();
     $db = $this->db();
     try {
         $db->BeginTrans();
         if (empty($this->id)) {
             $this->ownerId = $this->changedById;
             $this->settings[FarmSetting::CREATED_BY_ID] = $this->ownerId;
             $this->settings[FarmSetting::CREATED_BY_EMAIL] = User::findPk($this->ownerId)->email;
             $this->added = new DateTime();
             $this->status = FARM_STATUS::TERMINATED;
             if (empty($this->settings[FarmSetting::TIMEZONE])) {
                 $this->settings[FarmSetting::TIMEZONE] = date_default_timezone_get();
             }
             $this->settings[FarmSetting::CRYPTO_KEY] = \Scalr::GenerateRandomKey(40);
             /* @var $governance Governance */
             $governance = Governance::findPk($this->envId, Governance::CATEGORY_GENERAL, Governance::GENERAL_LEASE);
             if (!empty($governance) && $governance->enabled) {
                 $this->settings[FarmSetting::LEASE_STATUS] = 'Active';
             }
             //TODO: unused field
             $this->region = Aws::REGION_US_EAST_1;
         }
         parent::save();
         if (!empty($this->_settings)) {
             $this->_settings->save();
         }
         if (isset($this->_teamsChanged)) {
             $this->saveTeams($this->_teams);
             $this->_teamsChanged = false;
         }
         $db->CommitTrans();
     } catch (Exception $e) {
         $db->RollbackTrans();
         throw $e;
     }
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     parent::save();
     if (!empty($this->_properties)) {
         $this->_properties->save();
     }
 }