views:

327

answers:

2

I'm converting a flat list into a tree in my CakePHP app and found that there is an existing behavior that has this functionality. My table is not one giant tree, but consists of many user-generated trees: basically, each user can create their own folder structure. However it seems that the Tree Behavior would only keep track of lft/rght values across the entire table as if it is one giant tree. Hence if a new folder or sub-folder is added, the entire table needs to be updated.

Am I wrong about how the Tree Behavior actually works or if not, is there a way around this?

Reference Links:

A: 

This might work... BTreeBehavior on the Bakery

neilcrookes
Thanks, but the memory block approach seems a bit overkill. This other approach I just found, which you have commented on as well, seems more like what I'm looking for: http://jamienay.com/2010/01/adding-better-scope-limiting-to-cakephp-1-2s-tree-behavior/Ideally what I'd want is a kind of "grandparent" node that a sub-tree is relative too. I think Jamie's foreign key approach might work - will try that today!
828