本文整理汇总了PHP中Parameter::open_parameter_version_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::open_parameter_version_id方法的具体用法?PHP Parameter::open_parameter_version_id怎么用?PHP Parameter::open_parameter_version_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::open_parameter_version_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_version
/**
* @param integer $internal_revision
* @return integer
* @throws ParameterDeletePreviousVersionValueFailedException
* @throws ParameterDeletePreviousVersionFailedException
* @throws ParameterDeleteVersionValueFailedException
* @throws ParameterDeleteVersionFailedException
* @throws ParameterDeleteIDMissingException
*/
public function delete_version($internal_revision)
{
global $transaction;
if ($this->parameter_id and $this->parameter_version_id and $this->parameter_version and is_numeric($internal_revision)) {
$number_of_root_major_versions = ParameterVersion_Access::get_number_of_root_major_versions_by_parameter_id($this->parameter_id);
if ($number_of_root_major_versions > 1) {
$transaction_id = $transaction->begin();
$parameter_version_id = ParameterVersion_Access::get_entry_by_parameter_id_and_internal_revision($this->parameter_id, $internal_revision);
$minor_parameter_array = ParameterVersion_Access::list_entries_by_previous_version_id($parameter_version_id);
if (is_array($minor_parameter_array) and count($minor_parameter_array) >= 1) {
foreach ($minor_parameter_array as $fe_key => $fe_value) {
if (ParameterFieldValue_Access::delete_by_parameter_version_id($fe_value) == false) {
throw new ParameterDeletePreviousVersionValueFailedException();
}
$parameter = new Parameter($this->parameter_id);
$parameter->open_parameter_version_id($fe_value);
if ($parameter->delete_version($parameter->get_internal_revision()) == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
throw new ParameterDeletePreviousVersionFailedException();
}
}
}
if ($this->parameter_version->get_current() == true) {
$next_current_parameter_version_id = ParameterVersion_Access::get_last_uploaded_version_entry_by_parameter_id($this->parameter_id, $internal_revision);
$parameter_version_access = new ParameterVersion_Access($next_current_parameter_version_id);
$parameter_version_access->set_current(true);
}
if (ParameterFieldValue_Access::delete_by_parameter_version_id($this->parameter_version_id) == false) {
throw new ParameterDeleteVersionValueFailedException();
}
if ($this->parameter_version->delete() == false) {
if ($transaction_id != null) {
$transaction->rollback($transaction_id);
}
throw new ParameterDeleteVersionFailedException();
} else {
if ($transaction_id != null) {
$transaction->commit($transaction_id);
}
return 1;
}
} else {
if ($this->delete() == true) {
return 2;
}
}
} else {
throw new ParameterDeleteIDMissingException();
}
}