From 5513f569b68bc3f636967e86bacce9cdedd4ab6e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 4 Feb 2009 01:36:12 +0000 Subject: [PATCH] BUGFIX Including Hierarchy->children in flushCache() and renamed to _cache_children. This caused problems in TranslatableTest when re-using the same SiteTree->Children() method with different languages on the same object (even with calling flushCache() inbetween the calls) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71340 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/Hierarchy.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/model/Hierarchy.php b/core/model/Hierarchy.php index 16456073c..71f4b7d02 100644 --- a/core/model/Hierarchy.php +++ b/core/model/Hierarchy.php @@ -351,18 +351,18 @@ class Hierarchy extends DataObjectDecorator { * @return DataObjectSet */ public function Children() { - if(!(isset($this->children) && $this->children)) { + if(!(isset($this->_cache_children) && $this->_cache_children)) { $result = $this->owner->stageChildren(false); if(isset($result)) { - $this->children = new DataObjectSet(); + $this->_cache_children = new DataObjectSet(); foreach($result as $child) { if($child->canView()) { - $this->children->push($child); + $this->_cache_children->push($child); } } } } - return $this->children; + return $this->_cache_children; } /** @@ -594,6 +594,7 @@ class Hierarchy extends DataObjectDecorator { } function flushCache() { + $this->_cache_children = null; $this->_cache_allChildrenIncludingDeleted = null; $this->_cache_allChildren = null; }