Ticket #312 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

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

1.2-nestedset.diff Download (67.2 KB) - added by heltem 4 years ago.
Patch to support NestedSet in 1.2
1.3-nestedset.diff Download (84.2 KB) - added by heltem 4 years ago.

Change History

Changed 4 years ago by heltem

Patch to support NestedSet in 1.2

comment:1 follow-up: ↓ 8 Changed 4 years ago by heltem

  • Owner changed from hans to heltem

comment:2 Changed 4 years ago by heltem

  • Status changed from new to assigned

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

Changed 4 years ago by heltem

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

comment:8 in reply to: ↑ 1 Changed 4 years ago by trivoallan

Replying to heltem:

will the 1.2 patch be ever integrated to 1.2 sources ?

comment:9 Changed 4 years ago by soenke

1.2 should be bugfix only. All new development goes in 1.3+

Note: See TracTickets for help on using tickets.