save() public method

Saves settings entities to DB
public save ( )
示例#1
0
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     parent::save();
     if (!empty($this->_settings)) {
         $this->_settings->save();
     }
 }
示例#2
0
文件: Farm.php 项目: mheydt/scalr
 /**
  * {@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();
     }
 }
示例#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;
     }
 }
示例#4
0
文件: FarmRole.php 项目: mheydt/scalr
 /**
  * {@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();
     }
 }
示例#5
0
文件: Farm.php 项目: 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;
     }
 }
示例#6
0
文件: Server.php 项目: scalr/scalr
 /**
  * {@inheritdoc}
  * @see AbstractEntity::save()
  */
 public function save()
 {
     parent::save();
     if (!empty($this->_properties)) {
         $this->_properties->save();
     }
 }