Welcome Guest, Not a member yet? Register   Sign In
MPTtree, Hieararchical trees in a database table
#31

[eluser]Majd Taby[/eluser]
haha yes I don't want to steal your thread, could you PM me your email? gmail, msn or skype work for me
#32

[eluser]m4rw3r[/eluser]
I've now started to code on MPTtree version 0.2

Some things I'll add/edit:
- The Fusion feature, the addition of parent_id (an optional option, a fusion between Nested Sets and Adjacency list)
- Remake the locking system (not so much, but it will hopefully make it easier for me)
- A few new methods for the ORM (will be added in ignitedRecord as well)
- Renaming of a few ORM methods, to not confuse the user when using MPTtree and IgnitedRecord

So I ask:

Are there any specific features/changes you want to see in MPTtree 0.2?



PS. Wondering about if I should drop the ORM feature of MPTtree and concentrate my ORM work on IgnitedRecord, what do you think?
#33

[eluser]yami[/eluser]
Hi there,

thank you for sharing this nice work ... Smile

Is it possible to have multiple trees in one db-table?

Greets,
yami
#34

[eluser]m4rw3r[/eluser]
No, but you can use a common root node for all the trees in that table:
Code:
root------sometree-----somenode1
      |             \--somenode2
     ...            ...
      |---anothertree--anothernode1
      |              \-anothernode2
     ...            ...

BTW. A lot of my time is currently spent on coding IgnitedRecord, but I'll soon resume with the development of MPTtree
#35

[eluser]Hannes Nevalainen[/eluser]
MPTree @version 0.1.6-fix

The mpttree->move_node_append($move_lft,$to_lft); cast an error..
However, the function does what it's supposed to!
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: lft

Filename: models/mpttree.php

Line Number: 1323

Great model!

I have some suggestions to it.

1. I would like to get a branch of the tree from $lft up to the root.

2. Argh, just slipped my mind. ^^

Again N I C E work! =)
#36

[eluser]m4rw3r[/eluser]
That error is fixed in 0.1.6-fix2, which you can find here

If you want a branch from lft to root, use get_parents(lft, rgt).

EDITED just after post: I added the answer to the branch question.
#37

[eluser]Hannes Nevalainen[/eluser]
Oh, I found some more functions to add!

3. "Find the Immediate Subordinates of a Node"

4. "Depth of a Sub-Tree"

5." Finding the Depth of the Nodes"

6. "Finding all the Leaf Nodes"

I've been on my way building a Tree-model myself but since I found yours I don't need to anymore. I really enjoy working with yours!
Don't know if you need it but here is a nice walkthrough and SQL statements to the above functions.


//Hannes
#38

[eluser]m4rw3r[/eluser]
Already seen that one, but thanks anyway!

I'll see if I can find time to resume the development of MPTtree (and then after I've finished MPTtree v0.2 I'll probably got a few new ideas for IgnitedRecord v0.3 Tongue)
#39

[eluser]Hannes Nevalainen[/eluser]
Sounds greet! I'm already waiting =) (but no hurry!!!)

I'll tweak my suggestion number 3:

3. The function should be like mpttree->get_decendants($root_lft,$max_depth); then you could decide.

I just saw that one could use the ORM layer for that one... %-P
#40

[eluser]yami[/eluser]
Thanks for your quick reply m4rw3r.

Let's say about 2-3 people work at same time in that one table with multiple subtrees (all of them would work on different trees). Could that cause some problems?

Do you think, creating temporary tables for editing subtrees could be an alternative?




Theme © iAndrew 2016 - Forum software by © MyBB