Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [propel-dev] Re: News about NestedSet support in Propel ?

propel
Discussion topic

Back to topic list

Re: [propel-dev] Re: News about NestedSet support in Propel ?

Reply

Author Eric Fredj <eofredj at gmail dot com>
Full name Eric Fredj <eofredj at gmail dot com>
Date 2006-12-24 02:52:40 PST
Message Ok, as promised, I made a patch on 1.3 branch in order to add NestedSet
support.

I didn't commit it because, I am not currently satisfied.
Indeed, it is fully usable but it requires to use a specific Stub and
StubPeer in parallel with default ones.

So I decided to work now on an really integrated way to use NestedSet in a
transparent way...

Now provided features:

   - New builder to generate NestedSet object, peer and their stubs
   - Support for Iterator on NestedSet node in order to use it in a
   PreOrderTraversal way
   - Support for IteratorAggregate to retrieve right Iterator to use
   - Extended PropelPDO to add logging in prepare() method

Example insertion usage

$menu = new MenuNestedSet();
$menu->setText('Google');
$menu->setLink('http://www.google.com');

MenuNestedSetPeer::c​reateRoot($menu);

$child = new MenuNestedSet();
$child->setText('Google Mail');
$child->setLink('http://mail.google.com');
$child->insertAs​LastChildOf($menu);​

$child = new MenuNestedSet();
$child->setText('Google Maps');
$child->setLink('http://maps.google.com');
$child->insertAs​LastChildOf($menu);​

$sibling = new MenuNestedSet();
$sibling->setText('Yahoo!');
$sibling->setLink('http://www.yahoo.com');
$sibling->insert​AsNextSiblingOf($me​nu);

$child = new MenuNestedSet();
$child->setText('Yahoo! Mail');
$child->setLink('http://mail.yahoo.com');

$child->insertAs​LastChildOf($siblin​g);


Example Ttaversal usage
    $node = MenuNestedSetPeer::r​etrieveRoot();
    $level = 0;
    foreach($element as $node) {
        if($level < $node->getLevel()) {
            // Go deep (to leaf) in tree
        } else if ($level > $node->getLevel()) {
            // Go up (to root) in tree
        } else {
            // Stay in same level
        }
        $level = $node->getLevel();
    }

Enjoy it.

Happy X-Mas
ErIC

On 12/18/06, Eric Fredj <eofredj at gmail dot com> wrote:
>
> Ok, I didn't take a look on 1.3 branch until now but I think I can adapt
> the patch quickly.
> I will try to produce before X-Mas.
> By that time, I will attach the 1.2 patch on a Trac ticket when phpdb.orgwill be up :-)
>
> About coding guidelines, I tried to follow NodePeerBuilder* convention and
> all I was able to read on Trac Wiki but feel free to comment and make
> feedback ...
>
> PS :I asked for SVN account a few minutes ago ..
>
> Thx
> ErIC
>
>
> On 12/18/06, Hans Lellelid <hans at velum dot net> wrote:
> >
> > Hi Eric,
> >
> > Makes sense, ok. I think that this makes most sense in the 1.3 branch,
> > as it would break 1.2 BC (and 1.3 is not far from being ready). So, if
> > you want to create a ticket (or find that original ticket, if there is
> > one) and commit this stuff to 1.3, please do (and thanks!). Please see
> > coding & contributing guidelines, of course. Also let me know if you
> > need SVN account.
> >
> > Thanks,
> > Hans
> >
> >
> > Eric Fredj wrote:
> > > I forgot the main : I obviously made some specific NestedSet builder
> > > for Base classes and Stub classes ...
> > >
> > > On 12/18/06, *Eric Fredj* < eofredj at gmail dot com
> > > <mailto:eofredj@g​mail.com>> wrote:
> > >
> > > Patch was made in mind to be integrated in main tree because it
> > > requires some changes on the core:
> > >
> > > * database.xsd was updated to support some new attributes in
> > > schema.xml
> > > o In fact, I replaced isTree by treeMode in Table
> > > attribute to support several mode
> > > o I added some Column attribute to target left and right
> > > fields
> > > * PropelOMTask.php was modified to managed the new treeMode
> > > and call the new builder I added when needed
> > > * Column.php and Table.php to handle their new attributes
> > > * OMBuilder.php to handle new attributes and builder getter as
> > > it is done for Node builder
> > >
> > > Maybe the right way to share would be to create a parallel
> > > 1.2-nestedset (or something else) branch in which I could commit
> > > my job, improve it, fix it before you can merge it with main 1.2
> > > officiel branch.
> > > Moreover, it could be more easy to develop the same patch for 1.3
> > > then...
> > >
> > >
> > >
> > > On 12/18/06, *Hans Lellelid* < hans at velum dot net
> > > <mailto:hans@velu​m.net>> wrote:
> > >
> > > Hi Eric,
> > >
> > > Depending on what it is you've been creating, I think we can
> > > either add
> > > it to contrib or integrate it into main tree. My preference
> > > would be to
> > > add it to the contrib directory in SVN. I can get you an SVN
> > > account if
> > > you don't have one yet (please email offlist w/ desired
> > username).
> > >
> > >
> > >
> >
> > --------------------​--------------------​--------------------​---------
> > To unsubscribe, e-mail: dev-unsubscribe@prop​el.tigris.org
> > For additional commands, e-mail: dev-help at propel dot tigris dot org
> >
> >
>
Attachments

« Previous message in topic | 12 of 20 | Next message in topic »

Messages

Show all messages in topic

News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-17 04:35:07 PST
     Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-18 04:39:14 PST
         Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-18 06:20:10 PST
             Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-18 06:23:03 PST
                 RE: [propel-dev] Re: News about NestedSet support in Propel ? Soenke Ruempler - NorthClick <soenke dot ruempler at northclick dot de> Soenke Ruempler - NorthClick <soenke dot ruempler at northclick dot de> 2006-12-18 06:29:39 PST
                     Re: [propel-dev] trac/mod_python memory (was Re: News about NestedSet support in Propel ?) hlellelid Hans Lellelid 2006-12-18 06:29:49 PST
                         Re: [propel-dev] trac/mod_python memory (was Re: News about NestedSet support in Propel ?) Alan Pinstein <apinstein at mac dot com> Alan Pinstein <apinstein at mac dot com> 2006-12-18 07:45:57 PST
             Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-18 12:09:53 PST
                 Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-18 12:10:50 PST
                     Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-18 12:11:32 PST
                         Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-18 12:26:43 PST
                             Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-24 02:52:40 PST
                                 Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-24 03:34:48 PST
                                     Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-24 05:37:01 PST
                                         Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-24 09:30:04 PST
                                             Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-25 03:40:17 PST
                                                 Re: [propel-dev] Re: News about NestedSet support in Propel ? hlellelid Hans Lellelid 2006-12-25 04:57:26 PST
                                 Re: [propel-dev] Re: News about NestedSet support in Propel ? Thomas Rabaix <thomas at rabaix dot net> Thomas Rabaix <thomas at rabaix dot net> 2006-12-24 06:17:51 PST
                                     Re: [propel-dev] Re: News about NestedSet support in Propel ? Eric Fredj <eofredj at gmail dot com> Eric Fredj <eofredj at gmail dot com> 2006-12-27 14:46:50 PST
                                         Re: [propel-dev] Re: News about NestedSet support in Propel ? Thomas Rabaix <thomas at rabaix dot net> Thomas Rabaix <thomas at rabaix dot net> 2006-12-28 07:31:08 PST
Messages per page: