nested sets behavior

please give some sort of hint how to port this behavior to phalconphp it would be the great example of how to implement a non-trivial behavior in framework Thanks.


I don't have experience with Yii, I tried to migrate the behavior to Phalcon, it needs more work, but it could give you an idea of how to make it work:

I think that using traits could provide a better performance

I was thinking that it should extend Behavior, but the documentaiton on Behaviors doesn't give a good idea of where Category.php should be placed? I like this quite a bit.