/**
*
*/
protected function update()
{
$oldPath = $this->getDao()->getCurrentFullPath();
parent::update();
$config = \Pimcore\Config::getSystemConfig();
if ($oldPath && $config->documents->createredirectwhenmoved && $oldPath != $this->getRealFullPath()) {
// 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();
}
}