本文整理匯總了PHP中Pimcore\Model\Document::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Document::update方法的具體用法?PHP Document::update怎麽用?PHP Document::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Model\Document
的用法示例。
在下文中一共展示了Document::update方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
/**
*
*/
protected function update()
{
$oldPath = $this->getDao()->getCurrentFullPath();
parent::update();
$config = \Pimcore\Config::getSystemConfig();
if ($oldPath && $config->documents->createredirectwhenmoved && $oldPath != $this->getFullPath()) {
// create redirect for old path
$redirect = new Redirect();
$redirect->setTarget($this->getId());
$redirect->setSource("@" . $oldPath . "/?@");
$redirect->setStatusCode(301);
$redirect->setExpiry(time() + 86400 * 60);
// this entry is removed automatically after 60 days
$redirect->save();
}
}
示例2: update
/**
* @see Document::update
* @return void
*/
protected function update()
{
// update elements
$this->getElements();
$this->getDao()->deleteAllElements();
if (is_array($this->getElements()) and count($this->getElements()) > 0) {
foreach ($this->getElements() as $name => $element) {
if (!$element->getInherited()) {
$element->setDao(null);
$element->setDocumentId($this->getId());
$element->save();
}
}
}
// scheduled tasks are saved in $this->saveVersion();
// load data which must be requested
$this->getProperties();
$this->getElements();
// update this
parent::update();
// save version if needed
$this->saveVersion(false, false);
}