From 2f849222f8136ddad2e1203f825088c0b2e937b5 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Apr 2010 03:28:22 +0000 Subject: [PATCH] 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 --- core/model/SiteTree.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index dd7d47f5d..ffac9358d 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -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; }