MINOR: Make sure that Translatable creates a translated parent of SiteTree only when the parent is not translated (from r113955)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@113956 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Saophalkun Ponlu 2010-11-19 03:00:48 +00:00 committed by Sam Minnee
parent d01db84336
commit 8381858d58

View File

@ -771,7 +771,7 @@ class Translatable extends DataObjectDecorator implements PermissionProvider {
// Caution: This logic is very sensitve to infinite loops when translation status isn't determined properly
// If a parent for the newly written translation was existing before this
// onBeforeWrite() call, it will already have been linked correctly through createTranslation()
if($this->owner->hasField('ParentID')) {
if($this->owner->hasField('ParentID') && $this->owner instanceof SiteTree) {
if(
!$this->owner->ID
&& $this->owner->ParentID