Welcome Guest, Not a member yet? Register   Sign In
Nested Set library (aka MPTT, aka Hierarchy DB Trees)
#31

[eluser]CroNiX[/eluser]
Did you try the one from the first post in this thread?
#32

[eluser]extractortotem[/eluser]
first post in this thread says only lft, rgt, and parent.
but here: http://datamapper.wanwizard.eu/pages/ext...dsets.html
it says: left, right, root, name, value.
in the source code datamapper/nestedset.php in class DMZ_Nestedsets there are the following: $_leftindex, $_rightindex, $_rootfield and $_nodename (without symlink things).

so, I'm a little bit confused. Maybe it's two different things? I mean this documentation here http://datamapper.wanwizard.eu/pages/ext...dsets.html is maybe not for the latest downloadable version here: http://datamapper.wanwizard.eu/pages/download.html ?

Or what am I misunderstanding?

I'm a beginner in CI but this is somewhat crazy that I get only error messages all the time. It would be awesome to have a tutorial for absolute beginners about Datamapper ORM nestedset library.
Maybe it's not compatible with the newest version of CI? (...extends Controller <> ...extends CI_Controller...? The other strange thing is, however I have set up nestedset, NetBeans don't suggest functions, and I get error messages when I would like to use one.... for example the first thing is a Tree() what I'm not able to call. I don't know...)

how can I check why is this nestedset extension is not loaded? or where should I start searching for a solution?

Thanks!
regards,
ET
#33

[eluser]extractortotem[/eluser]
Hi,

at last... I managed to make it work. and it is really stupid simple. however I still believe that the documentation is confusing and a tutorial would be useful for absolute beginners. only a very little cleanup and additional info would be enough not to become completely confused as a beginner.
the only thing that bothers me is that Netbeans doesn't pop up possible methods of nestedset. Can this be somehow fixed?

and as far I as I see "level" is not updated automatically. do I have to make it manually all the time?

thanks a lot!
#34

[eluser]CroNiX[/eluser]
I think the problem is that 2 different libraries were discussed in this thread that both use MPTT. The datamapper that you are referring to is not the same as was discussed in the first post. So I think that's where your confusion is coming from.
#35

[eluser]Unknown[/eluser]
Just a heads-up - check the code of this library before using it, cause you can get a bad surprise from some methods. For example, the method
Code:
public function checkNodeIsChild($testNode, $controlNode) {
        return ($testNode[$this->parent_column_name] == $controlNode[$this->primary_key_column_name]);
    }
This method will return TRUE ONLY IF the $testNode is a direct child of the $controlNode. If it is down the tree more than one level, the method will return FALSE while the test node is still a child of the control.
From my point of view this method should look like this:
Code:
public function checkNodeIsChild($testNode, $controlNode) {
        return ($testNode[$this->left_column_name]>$controlNode[$this->left_column_name]
            && $testNode[$this->right_column_name]<$controlNode[$this->right_column_name]);
    }






Theme © iAndrew 2016 - Forum software by © MyBB