Zend_Db_NestedSet is an implementation of the modified pre-order traversal pattern for storing
hierarchical data structures in a relational database. This data storage pattern allows for fast
retrieval of tree-like structures that are used in common web page elements.
Hi Graham, it looks like we're working on similar proposals. I'm working with Nick Pack to add MPTT support to Zend_Db_Table. Maybe we can collaborate on this. Take a look at our proposal here:
Does it allow to store tree and the data in different tables? If no - it's not worth using. But the code has impressed me, I believe it may be improved in some ways (I haven't really examine yet, just some pieces, so sorry if I'm wrong somewhere).
I've been preparing similar proposal but got stuck with the implementation and the architecture (generally because of the lack of time not because of problems that can't be solved or smth like that) it's been paused now, but I can try to help you with some uncertainties you have. If you have some of course and you are interested at all - tell me if you are not.
2) DB queries should be separated in another file (probably). Yes, Zend_Db gives some universality already and you can probably switch the database easy, but it's not completly universal. Besides, it's quite logical to keep all the 'algorithm' stuff in one place and all the db related stuff in another. Check the link I gave above. You may not agree here, ignore it if so...
3) I suggest to extend it to the Zend_Db_Tree proposal with adapter based supporting of different kinds of algorithms (Nested Sets, adjacency lists, materialized paths). We should also support using them on their own.
Here is my class index:
Thanks for your comments but I will not be pursuing this proposal for inclusion to Zend Framework. Feel free to use/abuse anything posted on this page but the code in the github repo will be soon moving to a BSD incompatible License.
3 Comments
comments.show.hideJan 18, 2010
Hector Virgen
Hi Graham, it looks like we're working on similar proposals. I'm working with Nick Pack to add MPTT support to Zend_Db_Table. Maybe we can collaborate on this. Take a look at our proposal here:
http://framework.zend.com/wiki/pages/viewpage.action?pageId=15565007
Jan 23, 2010
Alexander Steshenko
Hello.
Does it allow to store tree and the data in different tables? If no - it's not worth using. But the code has impressed me, I believe it may be improved in some ways (I haven't really examine yet, just some pieces, so sorry if I'm wrong somewhere).
I've been preparing similar proposal but got stuck with the implementation and the architecture (generally because of the lack of time not because of problems that can't be solved or smth like that) it's been paused now, but I can try to help you with some uncertainties you have. If you have some of course and you are interested at all - tell me if you are not.
I have some suggestions by now:
1) You can check out my old code http://code.google.com/p/zfru-proposal-zend-db-tree/source/browse/ which was initial prepared for the proposal (it is only for nestedsed as yours). It's working live in some projects, you might find something useful there.
2) DB queries should be separated in another file (probably). Yes, Zend_Db gives some universality already and you can probably switch the database easy, but it's not completly universal. Besides, it's quite logical to keep all the 'algorithm' stuff in one place and all the db related stuff in another. Check the link I gave above. You may not agree here, ignore it if so...
3) I suggest to extend it to the Zend_Db_Tree proposal with adapter based supporting of different kinds of algorithms (Nested Sets, adjacency lists, materialized paths). We should also support using them on their own.
Here is my class index:
Zend_Db_Tree
Zend_Db_Tree_NodeAbstract
Zend_Db_Tree_NodeInterface
Zend_Db_Tree_Adapter_AdapterInterface
Zend_Db_Tree_Adapter_AdapterAbstract
Zend_Db_Tree_Adapter_Exception
Zend_Db_Tree_Adapter_DbAdapterAbstract
Zend_Db_Tree_Adapter_DbAdapterInterface
Zend_Db_Tree_Adapter_Nestedset
Zend_Db_Tree_Adapter_Nestedset_Node
Zend_Db_Tree_Adapter_Nestedset_DbAdapter_Pdo_Abstract
Zend_Db_Tree_Adapter_Nestedset_DbAdapter_Pdo_Mysql
...
Zend_Db_Tree_Adapter_Materializedpath
Zend_Db_Tree_Adapter_Materializedpath_Node
...
Zend_Db_Tree_Adapter_Adjacencylist
Zend_Db_Tree_Adapter_Adjacencylist_Node
...
not sure it's going to be useful, but just in case.
Apr 16, 2010
Graham Anderson
Thanks for your comments but I will not be pursuing this proposal for inclusion to Zend Framework. Feel free to use/abuse anything posted on this page but the code in the github repo will be soon moving to a BSD incompatible License.