本文整理汇总了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;
}