-
Notifications
You must be signed in to change notification settings - Fork 107
Description
I use ->getDescendants()->toTree() to get the whole tree and show it as a hierarchical list of checkboxes.
Up to version 5.1.1 this was one database hit (to get descendants).
select * from termsinner jointerm_closureonterm_closure.descendant=terms.idwhereterm_closure.ancestor= 1 andterm_closure.depth > 0
In version 6 it is now one database hit (to get descendants, same as above) and one database hit for each child
select * from termswhereterms.parent_id= 2 andterms.parent_id is not null
This makes building a larger tree very slow.
The problem seems to be on line 174 of Collection.php:
$result[$parentId]->children->add($item);
which used to be (in 5.1.1, Collection.php line 80)
$result[$parentId]->appendRelation($item->getChildrenRelationIndex(), $item);
Is there a way to get the tree without all these database hits?