本文整理匯總了PHP中Pimcore\Model\Document::getLatestVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP Document::getLatestVersion方法的具體用法?PHP Document::getLatestVersion怎麽用?PHP Document::getLatestVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Model\Document
的用法示例。
在下文中一共展示了Document::getLatestVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getLatestVersion
/**
* @param Model\Document $document
* @return Model\Document
*/
protected function getLatestVersion(Model\Document $document)
{
$latestVersion = $document->getLatestVersion();
if ($latestVersion) {
$latestDoc = $latestVersion->loadData();
if ($latestDoc instanceof Model\Document) {
$latestDoc->setModificationDate($document->getModificationDate());
// set de modification-date from published version to compare it in js-frontend
return $latestDoc;
}
}
return $document;
}
示例2: getLatestVersion
/**
* @param Document|Asset|ConcreteObject $element
* @return Document|Asset|ConcreteObject
*/
protected function getLatestVersion($element)
{
//TODO move this maybe to a service method, since this is also used in ObjectController and DocumentControllers
if ($element instanceof Document) {
$latestVersion = $element->getLatestVersion();
if ($latestVersion) {
$latestDoc = $latestVersion->loadData();
if ($latestDoc instanceof Document) {
$element = $latestDoc;
$element->setModificationDate($element->getModificationDate());
}
}
}
if ($element instanceof Object\Concrete) {
$modificationDate = $element->getModificationDate();
$latestVersion = $element->getLatestVersion();
if ($latestVersion) {
$latestObj = $latestVersion->loadData();
if ($latestObj instanceof ConcreteObject) {
$element = $latestObj;
$element->setModificationDate($modificationDate);
}
}
}
return $element;
}