[eluser]kev[/eluser]
Hi all,
I just started using datamapper orm, which i found nice. I'm trying to use the nestedsets extenstion that comes with it. I have a categories table with the following field,
id
root_id
left_id
right_id
title
Below is the code im using to test it,
Code:
$tree = new Category();
$tree->select_root(1);
$tree->title = 'First Category';
$tree->new_root();
$tree->get_root();
$tree->title = 'First Sub Category';
$tree->new_first_child();
I get this in the table, see below :
id root_id left_id right_id
1 1 1 4
2 1 2 3
have the data been inserted correctly?
I have uploaded an attachment also.
Now that the data is in the database, I tried to ouput it using dump_tree, see code below :
Code:
echo $tree->dump_tree( array('title'), 'html' , FALSE );
But using this I get a blank screen.
This is my model :
Code:
<?php
class Category extends DataMapper {
var $table = 'categories';
public $nestedsets = array(
'name' => 'title'
);
}
Can someome help me understand this?