Login | Register
My pages Projects Community openCollabNet

propel
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author hlellelid
Full name Hans Lellelid
Date 2006-12-24 05:37:01 PST
Message Hi Eric,

This all looks really great. My only suggestion is that as you create
this patch, if you could try to keep it clear which additions to the
main peer/object are nested set-related. That way, when we introduce
something like "features" support, turning all these peer customization
options into encapsulated add-ons, it will be easy to identify those
components.

Thanks for your contribution!

Hans

Eric Fredj wrote:
> Fix typo
>
> Example Ttaversal usage
> $root = MenuNestedSetPeer::r​etrieveRoot();
> $level = 0;
> foreach($root 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();
> }
>
> On 12/24/06, *Eric Fredj* <eofredj at gmail dot com
> <mailto:eofredj@g​mail.com>> wrote:
>
> 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'
> <http://www.google.com%27>);
>
> MenuNestedSetPeer::c​reateRoot($menu);
>
>
> $child = new MenuNestedSet();
> $child->setText('Google Mail');
> $child->setLink('
> http://mail.google.com' <http://mail.google.com%27>);
> $child->insertAs​LastChildOf($menu);​
>
>
> $child = new MenuNestedSet();
> $child->setText('Google Maps');
> $child->setLink('
> http://maps.google.com' <http://maps.google.com%27>);
> $child->insertAs​LastChildOf($menu);​
>
>
> $sibling = new MenuNestedSet();
> $sibling->setText('Yahoo!');
> $sibling->setLink('
> http://www.yahoo.com' <http://www.yahoo.com%27>);
> $sibling->insert​AsNextSiblingOf($me​nu);
>
>
> $child = new MenuNestedSet();
> $child->setText('Yahoo! Mail');
> $child->setLink('
> http://mail.yahoo.com' <http://mail.yahoo.com%27>);
>
> $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
> <mailto:eofredj@g​mail.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.org <http://phpdb.org> will 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
> <mailto:hans@velu​m.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>
> > <mailto: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 at velum dot net>
> > <mailto: 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
> <mailto:dev-unsub​scribe at propel dot tigris​.org>
> For additional commands, e-mail:
> dev-help at propel dot tigris dot org <mailto:dev-help@​propel.tigris.org​>
>
>
>
>
>