public function save() { $id = $this->db->getOne('SELECT id FROM `account_teams` WHERE name = ? AND account_id = ?', array($this->name, $this->accountId)); if ($id && $this->id != $id) { throw new Exception('Team with such name already exists'); } return parent::save(); }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { if (!$this->id) { $forceInsert = true; $this->id = Scalr::GenerateUID(true); } parent::save($forceInsert); }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { $id = $this->db->getOne('SELECT id FROM `account_teams` WHERE name = ? AND account_id = ? LIMIT 1', array($this->name, $this->accountId)); if ($id && $this->id != $id) { throw new Exception('Team with such name already exists'); } $ret = parent::save(); return $ret; }
public function save($forceInsert = false) { parent::save(); if ($this->preDeployScript !== false) { $this->db->Execute("UPDATE dm_applications SET pre_deploy_script = ? WHERE id = ?", array($this->preDeployScript, $this->id)); } if ($this->postDeployScript !== false) { $this->db->Execute("UPDATE dm_applications SET post_deploy_script = ? WHERE id = ?", array($this->postDeployScript, $this->id)); } }
public function save() { parent::save(); $this->db->Execute("DELETE FROM service_config_preset_data WHERE preset_id = ?", array($this->id)); foreach ($this->parameters as $param) { if ($param->getValue() != null) { //Save params $this->db->Execute("INSERT INTO service_config_preset_data SET\n\t\t\t\t\t\t`preset_id`\t= ?,\n\t\t\t\t\t\t`key`\t\t= ?,\n\t\t\t\t\t\t`value`\t\t= ?\n\t\t\t\t\t", array($this->id, $param->getName(), $param->getValue())); } } return true; }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { parent::save($forceInsert); // Save parts if ($this->isPartsChanged && $this->id) { $this->db->Execute("DELETE FROM services_db_backup_parts WHERE backup_id = ?", array($this->id)); foreach ($this->parts as $n => $part) { $this->db->Execute("INSERT INTO services_db_backup_parts SET\n `backup_id` \t= ?,\n `path`\t\t\t= ?,\n `size`\t\t\t= ?,\n `seq_number`\t= ?\n ", array($this->id, $part['path'], $part['size'], $n + 1)); } } return $this; }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { return parent::save($forceInsert); }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { $ret = parent::save($forceInsert); if ($this->id && \Scalr::getContainer()->analytics->enabled) { \Scalr::getContainer()->analytics->tags->syncValue($this->accountId, \Scalr\Stats\CostAnalytics\Entity\TagEntity::TAG_ID_USER, $this->id, $this->fullname ?: $this->email); } return $ret; }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { if ($this->db->GetOne("SELECT id FROM client_environments WHERE name = ? AND client_id = ? AND id != ? LIMIT 1", array($this->name, $this->clientId, $this->id))) { throw new Exception('This name already used'); } parent::save(); }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { if ($this->db->GetOne("SELECT id FROM client_environments WHERE name = ? AND client_id = ? AND id != ? LIMIT 1", array($this->name, $this->clientId, $this->id))) { throw new Exception('This name is already used'); } parent::save(); if ($this->id && \Scalr::getContainer()->analytics->enabled) { \Scalr::getContainer()->analytics->tags->syncValue($this->clientId, \Scalr\Stats\CostAnalytics\Entity\TagEntity::TAG_ID_ENVIRONMENT, $this->id, $this->name); } }
/** * {@inheritdoc} * @see Scalr_Model::save() */ public function save($forceInsert = false) { $this->httpdConf = str_replace(array("{literal}", "{/literal}"), array("", ""), $this->httpdConf); $this->httpdConfSsl = str_replace(array("{literal}", "{/literal}"), array("", ""), $this->httpdConfSsl); return parent::save($forceInsert); }
/** * Save current object to database * * @param bool $forceInsert optional Force insert. (false by default) * @param array $ignoredFields optional Fields that are not updated * @return Scalr_Model Return current object * * @throws Exception */ public function save($forceInsert = false, array $ignoredFields = null) { foreach ($ignoredFields ?: [] as $ignoredField) { if (array_key_exists($ignoredField, $this->dbPropertyMap)) { if (!is_array($this->dbPropertyMap[$ignoredField])) { $this->dbPropertyMap[$ignoredField] = ['property' => $this->dbPropertyMap[$ignoredField]]; } $this->dbPropertyMap[$ignoredField]['update'] = false; } } return parent::save($forceInsert); }