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

[eluser]CtheB[/eluser]
Oke thank you, i will do that when i have time for it. And then i'll post the results here.
#92

[eluser]TheFuzzy0ne[/eluser]
Martin, did you see my comments above? http://ellislab.com/forums/viewreply/562453/

I was also wondering if you had plans to rename hasChildren to has_children for consistency.

Thanks.
#93

[eluser]m4rw3r[/eluser]
I think it is complete, I cannot create the menu generating code without creating something which less than half will use.
But next time I release a new version - hopefully not too far in the future - I will provide an example menu + admin or something similar.

And I definitely plan to rename hasChildren() to has_children(), I have to claim I was young and stupid (also, I coded PERL before I started with PHP Wink)
#94

[eluser]Andreas Krohn[/eluser]
I want to use MPTtree via the IgnitedRecord behaviour "tree". Currently I am using MPTtree 0.1.6-fix2, but I am having problems. For example children() and descendants() does not work. I suspect that a version missmatch is causing these problems as well as the problems I reported in this thread.

Is there any specific version of MPTtree I need to use with the latest IgnitedRecord (downloaded from svn)?
#95

[eluser]m4rw3r[/eluser]
It is nothing (well, in this case - I can see many things that can be better with MPTtree) wrong with MPTtree.
It is the tree behaviour that isn't updated to the new IgnitedRecord architecture.

I figured I should rewrite the tree behavour when I started to rewrite MPTtree - which I quickly abandoned, because IR demanded more attention.
Hopefully I can do a rewrite of MPTree when I'm finished with my new database abstraction (which is something I also do to get good grades).
#96

[eluser]Andreas Krohn[/eluser]
Thanks for your quick answer (as well as a great library!). So if I want to use MPTtree I should just use it as a seperate thing and not via the IgnitedRecord behaviour?
#97

[eluser]m4rw3r[/eluser]
Ok, I think I found the problem: the dbobj2orm() method converts only DB_resultConfused to orm objects.
So to fix that a little update to base_php5.php (or base.php) is required:

Code:
// in base_php5.php
// method dbobj2orm()

//// replace:
// fetch results
foreach($db_obj->result_array() as $row_count => $row)

//// with:
// fetch results
if( ! is_array($db_obj))
{
    $db_obj = $db_obj->result_array();
}

foreach($db_obj as $row_count => $row)
//// end replace

//// replace:
// clear db object
$db_obj->free_result();

//// with:
if(is_object($db_obj))
{
    // clear db object
    $db_obj->free_result();
}
I think that should do it.
#98

[eluser]TheFuzzy0ne[/eluser]
Hi, Martin.

I'm looking at the insert_node() method, and whilst I understand it's meant primarily for internal use, it looks like if I make a typo when I am supplying the data, I'll end up with a gap in my tree. Is that correct?

I was wondering whether it might be better to run those two update queries after the data has been inserted successfully. What do you think? If you did this, you'd have to expand on the two update queries, so that they ignore the newly inserted row.
#99

[eluser]sshz[/eluser]
I have ~700 nodes tree and mysql request for get_children for my root node is about 7 seconds, is this normal?

I need to get first level children for ~6000 nodes tree, with fast(less then one second) request, is it possible?

[eluser]TheFuzzy0ne[/eluser]
I don't see why not. Are you sure you've indexed the tables correctly?




Theme © iAndrew 2016 - Forum software by © MyBB