Using sfPropelActAsNestedSetBehaviorPlugin, if I delete a leaf node I still
need to update the tree to make sure there are no gaps left in the
left/right values, right?

First of all, I am assuming that I need to update the whole tree (not just
the nodes that come after the deleted leaf node) because the deletion of any
node anywhere in the tree should reduce the right value of the root node by
2.

Assuming this is true. This is the way I expect I have to do it:

1) load the entire tree into an array (using the ScopeId), sorted by left
value.

2) iterate over the entire array of tree nodes. Re-attach each node to its
parent so that left & right values are updated properly, using the ParentId
to insertAsLastChildOf() and reload() the parent after each insertion.

Tristan (or any other experienced NestedSet users) could you confirm that
(a) a complete tree update is necessary after a node deletion (b) that the
method I suggest here is the way to go, or is there a better way?

Thanks in advance for any feedback.

--peterVG

P.S. if this is necessary, would it be possible to add a deleteLeaf() method
to the API since there are already a deleteChildren() and
deleteDescendants() method?




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to