Proposal for Zend_Db_NestedSet – Hierarchical data as a nested set

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

  1. http://framework.zend.com/wiki/display/ZFPROP/Zend_Db_NestedSet+-+Graham+Anderson
  2. http://github.com/gnanderson/ZF_NestedSet