Ticket #312 (closed enhancement: fixed)
Nested Set support
| Reported by: | heltem | Owned by: | heltem |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3 |
| Component: | Generator | Version: | 1.2.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I made a patch to support Nested Set in 1.2 branch.
It is inspired from joesimms proposal. Feel free to make feedback
Attachments
Change History
Changed 4 years ago by heltem
-
attachment
1.2-nestedset.diff
added
comment:3 Changed 4 years ago by heltem
I added in 1.3 patch PDO use instead of Creole and PDO statement use.
Example usage:
$menu = new MenuNestedSet();
$menu->setText('Google');
$menu->setLink('http://www.google.com');
MenuNestedSetPeer::createRoot($menu);
$child = new MenuNestedSet();
$child->setText('Google Mail');
$child->setLink('http://mail.google.com');
$child->insertAsLastChildOf($menu);
$child = new MenuNestedSet();
$child->setText('Google Maps');
$child->setLink('http://maps.google.com');
$child->insertAsLastChildOf($menu);
$sibling = new MenuNestedSet();
$sibling->setText('Yahoo!');
$sibling->setLink('http://www.yahoo.com');
$sibling->insertAsNextSiblingOf($menu);
$child = new MenuNestedSet();
$child->setText('Yahoo! Mail');
$child->setLink('http://mail.yahoo.com');
$child->insertAsLastChildOf($sibling);
comment:4 Changed 4 years ago by heltem
I fixed some missing features and added Iterator and IteratorAggregate implementation.
It seems to be usable but it is used as an external Peer and external Stub in parallel with standard Peer and Stub.
So, I am now working on an Propel integration in the way Joe Simms proposed with a full integration in existing Stub and Peer
comment:5 follow-up: ↓ 7 Changed 4 years ago by soenke
I did not look into the patch yet, but qhat would be really nice is integration of the RecursiveIterator, so that you can iterate over the whole tree with one foreach().
Have a look at: http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf
Thanks for your work.
comment:6 Changed 4 years ago by heltem
- Status changed from assigned to closed
- Resolution set to fixed
Added and commited in [501]
comment:7 in reply to: ↑ 5 Changed 4 years ago by heltem
Replying to soenke:
I did not look into the patch yet, but qhat would be really nice is integration of the RecursiveIterator, so that you can iterate over the whole tree with one foreach().
Have a look at: http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf
I didn't used the RecursiveIterator? but the Iterator implementation allow you to iterate over the whole tree with only one foreach(). But it's surely be useful I take a look on your link. Thanks
Patch to support NestedSet in 1.2