本文整理汇总了PHP中eZContentObject::cleanupInternalDrafts方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::cleanupInternalDrafts方法的具体用法?PHP eZContentObject::cleanupInternalDrafts怎么用?PHP eZContentObject::cleanupInternalDrafts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::cleanupInternalDrafts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTranslation
/**
* Adds a translation in language $newLanguageCode for object
*
* @param string $newLanguageCode
* @param mixed $translationData array( attribute identifier => attribute value )
* @return void
*/
public function addTranslation($newLanguageCode, $translationData)
{
// Make sure to refresh the objects data.
$this->refresh();
$this->object->cleanupInternalDrafts();
$version = $this->object->createNewVersionIn($newLanguageCode);
$version->setAttribute('status', eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
$version->store();
$newVersion = $this->object->version($version->attribute('version'));
$newVersionAttributes = $newVersion->contentObjectAttributes($newLanguageCode);
$versionDataMap = self::createDataMap($newVersionAttributes);
// Start updating new version
$version->setAttribute('modified', time());
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$db = eZDB::instance();
$db->begin();
$version->store();
// @TODO: Add generic datatype support here
foreach ($translationData as $attr => $value) {
if ($versionDataMap[$attr]->attribute('data_type_string') == "ezxmltext") {
$value = $this->processXmlTextData($value, $versionDataMap[$attr]);
}
$versionDataMap[$attr]->setAttribute('data_text', $value);
$versionDataMap[$attr]->store();
}
$db->commit();
//Update the content object name
$db->begin();
$this->object->setName($this->class->contentObjectName($this->object, $version->attribute('version'), $newLanguageCode), $version->attribute('version'), $newLanguageCode);
$db->commit();
// Finally publish object
self::publishContentObject($this->object, $version);
}
示例2: __destruct
/**
* Destructor.
*/
public function __destruct()
{
$this->contentObject->cleanupInternalDrafts();
// Free some memory
$this->flush();
}