當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parameter::open_parameter_version_id方法代碼示例

本文整理匯總了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();
     }
 }
開發者ID:suxinde2009,項目名稱:www,代碼行數:61,代碼來源:parameter.class.php


注:本文中的Parameter::open_parameter_version_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。