本文整理匯總了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;
}
示例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;
}