mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
bd2b9efede
commit
5513f569b6
@ -351,18 +351,18 @@ class Hierarchy extends DataObjectDecorator {
|
|||||||
* @return DataObjectSet
|
* @return DataObjectSet
|
||||||
*/
|
*/
|
||||||
public function Children() {
|
public function Children() {
|
||||||
if(!(isset($this->children) && $this->children)) {
|
if(!(isset($this->_cache_children) && $this->_cache_children)) {
|
||||||
$result = $this->owner->stageChildren(false);
|
$result = $this->owner->stageChildren(false);
|
||||||
if(isset($result)) {
|
if(isset($result)) {
|
||||||
$this->children = new DataObjectSet();
|
$this->_cache_children = new DataObjectSet();
|
||||||
foreach($result as $child) {
|
foreach($result as $child) {
|
||||||
if($child->canView()) {
|
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() {
|
function flushCache() {
|
||||||
|
$this->_cache_children = null;
|
||||||
$this->_cache_allChildrenIncludingDeleted = null;
|
$this->_cache_allChildrenIncludingDeleted = null;
|
||||||
$this->_cache_allChildren = null;
|
$this->_cache_allChildren = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user