本文整理匯總了PHP中AttributeValue::UnassociateAllAttributeOptionsAsMultiple方法的典型用法代碼示例。如果您正苦於以下問題:PHP AttributeValue::UnassociateAllAttributeOptionsAsMultiple方法的具體用法?PHP AttributeValue::UnassociateAllAttributeOptionsAsMultiple怎麽用?PHP AttributeValue::UnassociateAllAttributeOptionsAsMultiple使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AttributeValue
的用法示例。
在下文中一共展示了AttributeValue::UnassociateAllAttributeOptionsAsMultiple方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SetAttribute
/**
* Sets an attribute value for this person.
* Data Type of $mixValue is dependent on the Data Type for the attribute being set.
* @param Attribute $objAttribute
* @param mixed $mixValue
* @return AttributeValue
*/
public function SetAttribute(Attribute $objAttribute, $mixValue)
{
$objValue = AttributeValue::LoadByAttributeIdPersonId($objAttribute->Id, $this->intId);
if (!$objValue) {
$objValue = new AttributeValue();
$objValue->Attribute = $objAttribute;
$objValue->Person = $this;
}
switch ($objAttribute->AttributeDataTypeId) {
case AttributeDataType::Text:
$objValue->TextValue = $mixValue;
break;
case AttributeDataType::Checkbox:
$objValue->BooleanValue = $mixValue;
break;
case AttributeDataType::Date:
$objValue->DateValue = $mixValue;
break;
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
$objValue->SingleAttributeOption = $mixValue;
break;
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$objValue->Save();
$objValue->UnassociateAllAttributeOptionsAsMultiple();
foreach ($mixValue as $objOption) {
$objValue->AssociateAttributeOptionAsMultiple($objOption);
}
break;
default:
throw new Exception('Unhandled Attribute Data Type');
}
$objValue->Save();
return $objValue;
}