Proposal for Zend_Db_NestedSet — Hierarchical data as a nested set

Gra­ham Ander­son writes a very inter­est­ing pro­posal; If you are inter­ested in an imple­men­ta­tion of stor­ing and retriev­ing hier­ar­chi­cal data as a nested set, please take a few min­utes to review my new proposal[1].

I dusted off some old code and poked and prod­ded a lit­tle until it behaved some­what as expected, there’s a func­tion­ing pro­to­type on GitHub[2] with some basic instruc­tions in the README.

As you prob­a­bly guessed the algo­rithm is mod­i­fied pre-order tra­ver­sal, and the cur­rent work­ing func­tion­al­ity is as follows

  • Store sin­gle trees or mul­ti­ple trees in same table
  • Add, move & delete indi­vid­ual tree nodes or tree branches
  • oper­ate on result set nodes(getPath(),getSiblings(),getDescendants(), etc )
  • Result-set as multi-dimensional asso­cia­tive array (Zend_Navigation)
  • Result-set as recur­sive 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

Tags: , , ,

2 Responses to "Proposal for Zend_Db_NestedSet — Hierarchical data as a nested set"

  • TSwain says:
Leave a Comment

*

Get Adobe Flash playerPlugin by wpburn.com wordpress themes