Graham Anderson writes a very interesting proposal; If you are interested in an implementation of storing and retrieving hierarchical data as a nested set, please take a few minutes to review my new proposal[1].
I dusted off some old code and poked and prodded a little until it behaved somewhat as expected, there’s a functioning prototype on GitHub[2] with some basic instructions in the README.
As you probably guessed the algorithm is modified pre-order traversal, and the current working functionality is as follows
- Store single trees or multiple trees in same table
- Add, move & delete individual tree nodes or tree branches
- operate on result set nodes(getPath(),getSiblings(),getDescendants(), etc )
- Result-set as multi-dimensional associative array (Zend_Navigation)
- Result-set as recursive iterator
Cheers the noo,
Graham
Use Case #2 makes this a very interesting class;
Spice that with some ACL etc and you have a very nice way och NOT using XML files for the Zend_Navigation component 🙂
I usually don’t post on Blogs but ya forced me to, great info.. excellent! … I’ll add a backlink and bookmark your site.