I just started using it, but I haven't done thorough tests to check the performance. So far so good.
Anyone use franzose/ClosureTable - any good or other ?
I tried using a number of Nested Sets, but it a performance hog. Anyone using this or any other closure tables. I'm have a 4 level depth folder type structure.
Thanks to Jarek for pointing me in this direction.
Cheers
Performance-wise it will be better than nested sets for sure. I haven't used the package enough to give feedback, but I suppose it's good. Anyway you can pretty easily do it yourself if you like.
Have a look at this example of how to build a tree from the collection https://laracasts.com/discuss/channels/general-discussion/eloquent-infinite-children-into-usable-array-and-render-it-to-nested-ul/replies/34455
It's trivial with closure table to build a tree (or subtree):
$someId; // id of the directory you want subtree for
// get the Tree collection - check linked post
$descendants = Directory::join('directory_closure as c', 'c.ancestor_id', '=', 'directories.id')
->where('c.ancestor_id', $someId)
->select('directories.*')
->get();
// build nested tree structure
$subTree = $descendants->buildTree();
Saving new entries is just a little bit harder, but pretty much as fast as simple inserts - that's huge advantage compared to nested set pattern.
Please or to participate in this conversation.