mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add a comment and only apply caching if using the standard NumChildrenMethod
This commit is contained in:
parent
77339b7e75
commit
13c89d0ed0
@ -454,7 +454,13 @@ class TreeDropdownField extends FormField
|
||||
$obj = null;
|
||||
$sourceObject = $this->getSourceObject();
|
||||
|
||||
Hierarchy::prepopulate_numchildren_cache($sourceObject);
|
||||
// Precache numChildren count if possible.
|
||||
if ($this->getNumChildrenMethod() == 'numChildren') {
|
||||
// We're not calling `Hierarchy::prepopulateTreeDataCache()` because we're not customising results based
|
||||
// on version or Fluent locales. So there would be no performance gain from additional caching.
|
||||
Hierarchy::prepopulate_numchildren_cache($sourceObject);
|
||||
}
|
||||
|
||||
if ($id && !$request->requestVar('forceFullTree')) {
|
||||
$obj = DataObject::get_by_id($sourceObject, $id);
|
||||
$isSubTree = true;
|
||||
|
Loading…
Reference in New Issue
Block a user