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.
<p>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:</p>
<p>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).</p>
<p>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.</p>
<p>I have some suggestions by now:</p>
<p>1) You can check out my old code <a class="external-link" href="http://code.google.com/p/zfru-proposal-zend-db-tree/source/browse/">http://code.google.com/p/zfru-proposal-zend-db-tree/source/browse/</a> 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.</p>
<p>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...</p>
<p>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. <br />
Here is my class index:</p>
<p>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.</p>
3 Comments
comments.show.hideJan 18, 2010
Hector Virgen
<p>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:</p>
<p><a class="external-link" href="http://framework.zend.com/wiki/pages/viewpage.action?pageId=15565007">http://framework.zend.com/wiki/pages/viewpage.action?pageId=15565007</a></p>
Jan 23, 2010
Alexander Steshenko
<p>Hello.</p>
<p>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).</p>
<p>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.</p>
<p>I have some suggestions by now:</p>
<p>1) You can check out my old code <a class="external-link" href="http://code.google.com/p/zfru-proposal-zend-db-tree/source/browse/">http://code.google.com/p/zfru-proposal-zend-db-tree/source/browse/</a> 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.</p>
<p>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...</p>
<p>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. <br />
Here is my class index:</p>
<p>Zend_Db_Tree</p>
<p>Zend_Db_Tree_NodeAbstract<br />
Zend_Db_Tree_NodeInterface</p>
<p>Zend_Db_Tree_Adapter_AdapterInterface<br />
Zend_Db_Tree_Adapter_AdapterAbstract</p>
<p>Zend_Db_Tree_Adapter_Exception</p>
<p>Zend_Db_Tree_Adapter_DbAdapterAbstract<br />
Zend_Db_Tree_Adapter_DbAdapterInterface</p>
<p>Zend_Db_Tree_Adapter_Nestedset<br />
Zend_Db_Tree_Adapter_Nestedset_Node<br />
Zend_Db_Tree_Adapter_Nestedset_DbAdapter_Pdo_Abstract<br />
Zend_Db_Tree_Adapter_Nestedset_DbAdapter_Pdo_Mysql<br />
...<br />
Zend_Db_Tree_Adapter_Materializedpath<br />
Zend_Db_Tree_Adapter_Materializedpath_Node<br />
...<br />
Zend_Db_Tree_Adapter_Adjacencylist<br />
Zend_Db_Tree_Adapter_Adjacencylist_Node<br />
...</p>
<p>not sure it's going to be useful, but just in case.</p>
Apr 16, 2010
Graham Anderson
<p>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.</p>