yiiext / nested-set-behavior

AR models behavior that allows to work with nested sets tree.
http://www.yiiframework.com/extension/nestedsetbehavior/
BSD 3-Clause "New" or "Revised" License
157 stars 64 forks source link

Can't move root nodes in many roots mode #33

Open witzawitz opened 10 years ago

witzawitz commented 10 years ago

When I try to do so an exceprion occurs. So I guess this happens because of restarting the 'lft' and 'rgt' indexes within every root node. It's really not a good practice.

Here's some info on stackoverflow http://stackoverflow.com/questions/1773343/how-to-query-nested-set-model-with-multiple-roots-plus-filtering

max107 commented 10 years ago

@witzawitz Sorting possible via root field.

Current behavior logic: $model->root = $model->pk. New logic is: $model->root = MAX(root)+1.

You can use next workaround: https://gist.github.com/max107/10723289.

_WARNING_ Single root mode removed from class.

Based on django-mptt logic.

yuracher commented 8 years ago

How to move root before/after other root (for example move Cars before Mobile phones)?

andreymeretsky commented 8 years ago

How to move root before/after other root (for example move Cars before Mobile phones)?

The same problem.

max107 commented 8 years ago

https://gist.github.com/max107/10723289 like a django-mptt