Nested Sets AKA Modified Pre-order Tree Traversal

Implementation for laravel, maybe it is good time to start thinking about something like this in phalcon

This is a very interesting pattern to include in the framework. I am sure we will but not sure which version. I am thinking maybe 1.1 or 1.2.

I am very glad that you think so too. I'm looking forward to it.


hi, for sure, a core implementation of uch a feature would be great, because who have never had to deal with data trees ? But, my two cents, adjacent tree and nested sets are two differents kind of approach. The first one is good if you have a lot of tree manipulation to do but is not appropriate for big trees. The second one is quiet ressources consumming when manipulating the tree, but is excellent for querying it. Morality: you will have to devellop these two approaches ;-)

BW, here are two php libraries for tree handling: nested sets: there's also a pear package : adjacent list:


nested sets +1

Hi, Is any chance to implement in core of Phalcon MPTT pattern? Good explanation:

this is my attempt to implementing MPTT pattern, there is still a lot work to do, love to hear ideas from you guys

... I've never read this thread until i've done an attempt of MPTT implementation too. u_u Here is my gihtub repository :

Hope it can helps someone. I'm totally open minded to receive critics on my code (please do not hesitate). Otherwise Baobab seems to be really good.

-- Benny Leonard Enrico Panggabean> The first thing I can say about your work is that it's not really reusable for other projects or areas in your own project. I think if you did it generical, this would be cool ;) Also your code needs some comments.

@Corentin Legros thank you for sharing your code, and in reply to your comment, yes i will put some comments later on after testing it first, to put in generic i was confused to chose either to change it into traits or change it into behavior :)

I've ported last gist into behavior is not fully finish and still a lot work to do, I'm totally open minded to receive critics on my code (please do not hesitate). for details you can see it here :

+1 for nested set model. Multiple trees would be aweseome, too!