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