本文整理匯總了PHP中eZContentClass::storeDefined方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZContentClass::storeDefined方法的具體用法?PHP eZContentClass::storeDefined怎麽用?PHP eZContentClass::storeDefined使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::storeDefined方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: store
/**
* Store the modification made to an eZContentClass.
*
* @param eZContentClass Content class to be stored.
* @param array[eZContentClassAttribute] Attributes of the new content class.
* @param array Unordered view parameters
*/
public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
{
$oldClassAttributes = $class->fetchAttributes($class->attribute('id'), true, eZContentClass::VERSION_STATUS_DEFINED);
// Delete object attributes which have been removed.
foreach ($oldClassAttributes as $oldClassAttribute) {
$attributeExists = false;
$oldClassAttributeID = $oldClassAttribute->attribute('id');
foreach ($class->fetchAttributes() as $newClassAttribute) {
if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
$attributeExists = true;
break;
}
}
if (!$attributeExists) {
foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
$objectAttribute->removeThis($objectAttribute->attribute('id'));
}
}
}
$class->storeDefined($attributes);
// Add object attributes which have been added.
foreach ($attributes as $newClassAttribute) {
$attributeExists = false;
$newClassAttributeID = $newClassAttribute->attribute('id');
foreach ($oldClassAttributes as $oldClassAttribute) {
if ($newClassAttributeID == $oldClassAttribute->attribute('id')) {
$attributeExists = true;
break;
}
}
if (!$attributeExists) {
$newClassAttribute->initializeObjectAttributes($objects);
}
}
}