BUGFIX: fixed onBeforeDuplicate calling before page existed (from r96879)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102411 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 03:28:22 +00:00
parent 7b3e45539b
commit 2f849222f8

View File

@ -497,13 +497,15 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*/
public function duplicate($doWrite = true) {
$this->extend('onBeforeDuplicate', $page);
$page = parent::duplicate(false);
$page->Sort = 0;
$this->extend('onBeforeDuplicate', $page);
if($doWrite) {
$page->write();
}
$this->extend('onAfterDuplicate', $page);
return $page;
}