本文整理汇总了PHP中OnApp::save方法的典型用法代码示例。如果您正苦于以下问题:PHP OnApp::save方法的具体用法?PHP OnApp::save怎么用?PHP OnApp::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OnApp
的用法示例。
在下文中一共展示了OnApp::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAdminNote
/**
* Edit Administrator's Note
*
* @param int $id virtual machine id
* @param string $admin_note Administrator's Note
*
* @return void
*/
function editAdminNote($id, $admin_note)
{
if ($admin_note) {
$this->_admin_note = $admin_note;
}
if ($id) {
$this->_id = $id;
}
parent::save();
}
示例2: save
/**
* The method saves an Object to your account
*
* After sending an API request to create an object or change the data in
* the existing object, the method checks the response and loads the
* exisitng object with the new data.
*
* This method can be closed for read only objects of the inherited class
* <code>
* function save() {
* $this->logger->error(
* "Call to undefined method ".__CLASS__."::save()",
* __FILE__,
* __LINE__
* );
* }
* </code>
*
* @return void
* @access public
*/
function save()
{
if (is_null($this->_limit)) {
$this->_limit = isset($this->_limits->_limit) ? $this->_limits->_limit : (isset($this->_obj->_limits->_limit) ? $this->_obj->_limits->_limit : '');
}
if (is_null($this->_limit_free)) {
$this->_limit_free = isset($this->_limits->_limit_free) ? $this->_limits->_limit_free : (isset($this->_obj->_limits->_limit_free) ? $this->_obj->_limits->_limit_free : '');
}
if (is_null($this->_price_on)) {
$this->_price_on = isset($this->_prices->_price_on) ? $this->_prices->_price_on : (isset($this->_obj->_prices->_price_on) ? $this->_obj->_prices->_price_on : '');
}
if (is_null($this->_price_off)) {
$this->_price_off = isset($this->_limits->_price_off) ? $this->_prices->_price_off : (isset($this->_obj->_prices->_price_off) ? $this->_obj->_prices->_price_off : "");
}
if (is_null($this->_price)) {
$this->_price = isset($this->_limits->_price) ? $this->_prices->_price : (isset($this->_obj->_prices->_price) ? $this->_obj->_prices->_price : '');
}
return parent::save();
}
示例3: save
/**
* The method saves an Object to your account
*
* @param integer $vm_id VM ID
*
* @return mixed Serialized API Response
* @access private
*/
function save()
{
if ($this->_virtual_machine_id) {
$this->fields['require_format_disk'] = array(ONAPP_FIELD_MAP => '_require_format_disk', ONAPP_FIELD_TYPE => 'integer', ONAPP_FIELD_REQUIRED => true, ONAPP_FIELD_DEFAULT_VALUE => false);
}
if ($this->_id) {
$this->fields['add_to_linux_fstab'][ONAPP_FIELD_REQUIRED] = false;
$this->fields['data_store_id'][ONAPP_FIELD_REQUIRED] = false;
$this->fields['is_swap'][ONAPP_FIELD_REQUIRED] = false;
$this->fields['mount_point'][ONAPP_FIELD_REQUIRED] = false;
}
return parent::save();
}
示例4: save
/**
* The method saves an Object to your account
*
* After sending an API request to create an object or change the data in
* the existing object, the method checks the response and loads the
* exisitng object with the new data.
*
* @return void
* @access public
*/
function save()
{
$fields = $this->fields;
$_unset = array('priority', 'hostname', 'port', 'weight', 'ip', 'txt', 'serial', 'primaryNs', 'retry', 'refresh', 'minimum', 'expire', 'hostmaster');
foreach ($_unset as $field) {
$this->fields[$field][ONAPP_FIELD_REQUIRED] = false;
}
switch ($this->_type) {
case 'MX':
$this->fields['priority'][ONAPP_FIELD_REQUIRED] = $this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
break;
case 'SRV':
$this->fields['port'][ONAPP_FIELD_REQUIRED] = $this->fields['weight'][ONAPP_FIELD_REQUIRED] = $this->fields['priority'][ONAPP_FIELD_REQUIRED] = $this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
break;
case 'A':
case 'AAAA':
$this->fields['ip'][ONAPP_FIELD_REQUIRED] = true;
break;
case 'CNAME':
case 'NS':
$this->fields['hostname'][ONAPP_FIELD_REQUIRED] = true;
break;
case 'TXT':
$this->fields['txt'][ONAPP_FIELD_REQUIRED] = true;
break;
case 'SOA':
trigger_error('Cannot save SOA record', E_USER_ERROR);
break;
default:
trigger_error(sprintf("Cannot save '%s' record", $this->_type), E_USER_ERROR);
break;
}
if (isset($this->_id)) {
$obj = $this->_edit();
$this->load();
} else {
return parent::save();
}
$this->fields = $fields;
}
示例5: save
public function save()
{
if (count($this->_countries) == 0) {
unset($this->fields['countries']);
}
return parent::save();
}
示例6: save
/**
* The method saves an Object to your account
*
* After sending an API request to create an object or change the data in
* the existing object, the method checks the response and loads the
* exisitng object with the new data.
*
* @return void
* @access public
*/
function save()
{
if (isset($this->_id)) {
$obj = $this->_edit();
$this->load();
} else {
parent::save();
}
}
示例7: save
function save()
{
$passowrd = $this->fields['passwords'];
unset($this->fields['passwords']);
if (is_null($this->_countries) && isset($this->_obj)) {
$this->_countries = $this->_obj->_countries;
} elseif (is_null($this->_countries)) {
$this->_countries = array('');
}
if (is_null($this->_secondary_hostnames) && isset($this->_obj) && count($this->_obj->_secondary_hostnames) != 0) {
$this->_secondary_hostnames = $this->_obj->_secondary_hostnames;
} else {
$this->_secondary_hostnames = array('');
}
$return = parent::save();
$this->fields['passwords'] = $passowrd;
return $return;
}
示例8: save
function save()
{
if ($this->_target_id) {
$this->fields['target_id'][ONAPP_FIELD_REQUIRED] = true;
$this->fields['target_type'][ONAPP_FIELD_REQUIRED] = true;
$this->fields['target_type'][ONAPP_FIELD_DEFAULT_VALUE] = 'Disk';
$this->fields['action'][ONAPP_FIELD_REQUIRED] = true;
$this->fields['action'][ONAPP_FIELD_DEFAULT_VALUE] = 'autobackup';
}
return parent::save();
}
示例9: save
/**
* Creates or edits Load Balancing Cluster
*
* @return mixed API query response
*/
function save()
{
$this->fields['load_balancer_attributes'] = array(ONAPP_FIELD_MAP => '_load_balancer_attributes');
$this->fields['load_balancing_cluster_load_balancer_attributes'] = array(ONAPP_FIELD_MAP => '_load_balancing_cluster_load_balancer_attributes');
$this->fields['auto_scaling_out_memory_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_out_memory_attributes');
$this->fields['auto_scaling_out_cpu_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_out_cpu_attributes');
$this->fields['auto_scaling_in_memory_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_in_memory_attributes');
$this->fields['auto_scaling_in_cpu_attributes'] = array(ONAPP_FIELD_MAP => '_auto_scaling_in_cpu_attributes');
$this->fields['available_vms'] = array(ONAPP_FIELD_MAP => '_available_vms');
$this->fields['image_template_id'] = array(ONAPP_FIELD_MAP => '_image_template_id');
parent::save();
$this->initFields($this->getAPIVersion());
return $result;
}
示例10: save
function save()
{
if ($this->_id) {
$this->fields['hypervisor_group_id'][ONAPP_FIELD_REQUIRED] = false;
}
return parent::save();
}