mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #8409 from open-sausages/pulls/4/treedropdown-caching
MINOR Add caching to the TreeDropdownField tree action
This commit is contained in:
commit
755907d117
@ -453,6 +453,14 @@ class TreeDropdownField extends FormField
|
|||||||
/** @var DataObject|Hierarchy $obj */
|
/** @var DataObject|Hierarchy $obj */
|
||||||
$obj = null;
|
$obj = null;
|
||||||
$sourceObject = $this->getSourceObject();
|
$sourceObject = $this->getSourceObject();
|
||||||
|
|
||||||
|
// 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')) {
|
if ($id && !$request->requestVar('forceFullTree')) {
|
||||||
$obj = DataObject::get_by_id($sourceObject, $id);
|
$obj = DataObject::get_by_id($sourceObject, $id);
|
||||||
$isSubTree = true;
|
$isSubTree = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user