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
This commit is contained in:
Ingo Schommer 2009-02-04 01:36:12 +00:00
parent bd2b9efede
commit 5513f569b6

View File

@ -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;
}