https://github.com/c...-set-behavior-2
This is new version of my https://github.com/y...ed-set-behavior
I really hope for feedback.
Page 1 of 1
Nested Set Behavior 2 Preview Version For Yii 2 Preview Version
#2
Posted 06 May 2013 - 06:28 AM
Did you basically adjust it to yii2's new ActiveRecords, or are there any new concepts?
One thing I didn't like about the original version (although I think it was the only option you had) was the use of a special save() method. I think it's kind of weird that you work with an AR, attach an behavior to it, and all of a sudden can't use its original methods any more. If the new AR design allows to change this, I think it would be a great improvement.
Other nice to have's:
- possibility to store the tree structure in a separate db table. Maybe really one structure table, for data from n other tables (but that would mean to loose FK constraint support).
- there are a few advanced nested set numbering methods available, I think mostly targeting the speed-up of structure changes. The basic method with lft, rgt running from 1 to n*2 when using n data sets has the disadvantage that you need to renumber large portions of the available datasets when changing the tree structure. Other methods try to use ranges, leaving space between lft and rgt for future insertions so you don't have to renumber on every write. Or they use floats instead of integers so that you can always insert a new element (insert between 1 and 2 --> use 1/2. Insert between 1/2 and 1 --> 1/4).
One thing I didn't like about the original version (although I think it was the only option you had) was the use of a special save() method. I think it's kind of weird that you work with an AR, attach an behavior to it, and all of a sudden can't use its original methods any more. If the new AR design allows to change this, I think it would be a great improvement.
Other nice to have's:
- possibility to store the tree structure in a separate db table. Maybe really one structure table, for data from n other tables (but that would mean to loose FK constraint support).
- there are a few advanced nested set numbering methods available, I think mostly targeting the speed-up of structure changes. The basic method with lft, rgt running from 1 to n*2 when using n data sets has the disadvantage that you need to renumber large portions of the available datasets when changing the tree structure. Other methods try to use ranges, leaving space between lft and rgt for future insertions so you don't have to renumber on every write. Or they use floats instead of integers so that you can always insert a new element (insert between 1 and 2 --> use 1/2. Insert between 1/2 and 1 --> 1/4).
Don't like ads in my sig...
#3
Posted 06 May 2013 - 07:10 AM
Ben, on 06 May 2013 - 06:28 AM, said:
Did you basically adjust it to yii2's new ActiveRecords, or are there any new concepts?
All new ActiveRecord concepts used.
Ben, on 06 May 2013 - 06:28 AM, said:
One thing I didn't like about the original version (although I think it was the only option you had) was the use of a special save() method. I think it's kind of weird that you work with an AR, attach an behavior to it, and all of a sudden can't use its original methods any more. If the new AR design allows to change this, I think it would be a great improvement.
New AR design can't allow this. This is php limitation.
Ben, on 06 May 2013 - 06:28 AM, said:
Other nice to have's:
- possibility to store the tree structure in a separate db table. Maybe really one structure table, for data from n other tables (but that would mean to loose FK constraint support).
- possibility to store the tree structure in a separate db table. Maybe really one structure table, for data from n other tables (but that would mean to loose FK constraint support).
You can do that with existing behavior.
Ben, on 06 May 2013 - 06:28 AM, said:
- there are a few advanced nested set numbering methods available, I think mostly targeting the speed-up of structure changes. The basic method with lft, rgt running from 1 to n*2 when using n data sets has the disadvantage that you need to renumber large portions of the available datasets when changing the tree structure. Other methods try to use ranges, leaving space between lft and rgt for future insertions so you don't have to renumber on every write. Or they use floats instead of integers so that you can always insert a new element (insert between 1 and 2 --> use 1/2. Insert between 1/2 and 1 --> 1/4).
Better to use another tree type. This is NS confines.
No good, no bad, only consequence.
#4
Posted 06 May 2013 - 07:14 AM
@creocoder: this is great. Could you summarize your feeling about the new AR design on the aspect of developing behaviors, compared with that in 1.1? I'd like to hear this feedback to see if we miss anything.
#5
Posted 06 May 2013 - 07:32 AM
@qiang: Thanks. I need to investigate a little more. After that i'll say my opinion.
No good, no bad, only consequence.
#6
Posted 06 May 2013 - 05:19 PM
/* extension authoring guidelines discussion split out into this topic: http://www.yiiframew...sion-authoring/ */
"Less noise - more signal"
#7
Posted 28 November 2013 - 04:20 AM
Hello.
Very nice extension. I want to ask, maybe you are going to add functionality of moving subtree to another node as parent?
I got 3000+ records in my tree and when one parent node is removed, I want easily move all its children to new parent.
Very nice extension. I want to ask, maybe you are going to add functionality of moving subtree to another node as parent?
I got 3000+ records in my tree and when one parent node is removed, I want easily move all its children to new parent.
Share this topic:
Page 1 of 1