[eluser]Andreas Krohn[/eluser]
I am using IgnitedRecord and it works like a charm. Now I want to use the IgnitedRecord behaviour Tree to use MPTtree, but that is where I run into problems. I suspect that I have not loaded the libraries etc I need correctly, but nothing I try seems to work....
The db is setup according to the manual, ie with id, lft, rgt and title. The MPTtree model is in my application/model directory.
This is my model:
Code:
class locations extends IgnitedRecord {
var $act_as = 'tree';
function locations() {
parent::IgnitedRecord();
}
}
In the constructor of my controller I load ORM and the locations model:
Code:
$this->load->ORM();
$this->load->model('locations');
In my controller I now want to find a location from my table and then check what parent the location has, this is what I try:
Code:
$country = $this->locations->find_by("title", "Sweden");
$parent = $country->parent();
However, I keep getting error messages like "IgnitedRecord: IR_record: Method parent() is not found." Have also tried calls like $country->tree->parent() etc, but no luck. I would be very grateful if anybody tell me what I am doing wrong, this is driving my crazy.