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


PHP Variable::CreateNewForName方法代碼示例

本文整理匯總了PHP中Variable::CreateNewForName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Variable::CreateNewForName方法的具體用法?PHP Variable::CreateNewForName怎麽用?PHP Variable::CreateNewForName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Variable的用法示例。


在下文中一共展示了Variable::CreateNewForName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: RestoreByNameForClass

 public static function RestoreByNameForClass($strName, $intClassId, $strVersion)
 {
     $objClassProperty = ClassProperty::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::ClassProperty()->QcodoClassId, $intClassId), QQ::Equal(QQN::ClassProperty()->Variable->Name, $strName)));
     if (!$objClassProperty) {
         $objConnectedClassVariable = ClassVariable::LoadByPartialNameForClass($strName, $intClassId);
         $objVariable = Variable::CreateNewForName($strName, $strVersion);
         $objClassProperty = new ClassProperty();
         $objClassProperty->QcodoClassId = $intClassId;
         $objClassProperty->VariableGroupId = 1;
         $objClassProperty->Variable = $objVariable;
         if ($objConnectedClassVariable) {
             $objClassProperty->ClassVariable = $objConnectedClassVariable;
             $objClassProperty->VariableGroupId = $objConnectedClassVariable->VariableGroupId;
         }
         $objClassProperty->Save();
     } else {
         if ($objClassProperty->Variable->LastVersion) {
             $objClassProperty->Variable->LastVersion = null;
             $objClassProperty->Variable->Save();
         }
         if ($objClassProperty->ClassVariable) {
             $objClassProperty->VariableGroupId = $objClassProperty->ClassVariable->VariableGroupId;
             $objClassProperty->Save();
         }
     }
     return $objClassProperty;
 }
開發者ID:qcodo,項目名稱:qcodo-api,代碼行數:27,代碼來源:ClassProperty.class.php

示例2: RestoreByNameForClass

 public static function RestoreByNameForClass($strName, $intClassId, $strVersion)
 {
     $objClassVariable = ClassVariable::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::ClassVariable()->QcodoClassId, $intClassId), QQ::Equal(QQN::ClassVariable()->Variable->Name, $strName)));
     if (!$objClassVariable) {
         $objVariable = Variable::CreateNewForName($strName, $strVersion);
         $objClassVariable = new ClassVariable();
         $objClassVariable->Variable = $objVariable;
         $objClassVariable->QcodoClassId = $intClassId;
         $objClassVariable->VariableGroupId = 1;
         $objClassVariable->ProtectionTypeId = ProtectionType::_Public;
         $objClassVariable->Save();
     } else {
         if ($objClassVariable->Variable->LastVersion) {
             $objClassVariable->Variable->LastVersion = null;
             $objClassVariable->Variable->Save();
         }
     }
     return $objClassVariable;
 }
開發者ID:qcodo,項目名稱:qcodo-api,代碼行數:19,代碼來源:ClassVariable.class.php


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