Modified Preorder Tree Traversal class for Kohana v3 ORM.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 7 commits ahead, 43 commits behind evopix:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

MPTT Library, extends ORM


Place module in /modules/ and include the call in your bootstrap.


return array
	'left_column' => 'lft',
	'right_column' => 'rgt',
	'level_column' => 'lvl',
	'scope_column' => 'scope',
	'parent_column' => 'parent_id'

Declaring your ORM object

class Model_Category extends ORM_MPTT {

Usage Examples

Creating a root node:

$cat = ORM::factory('Category_Mptt');
$cat->name = 'Music';
echo 'Category ID'.$mptt->id.' set at level '.$cat->lvl.' (scope: '.$cat->scope.')';
$c1 = $cat; // Saving id for next example

Creating a child node:

$cat->clear(); // Clearing ORM object
$cat->name = 'Terminology';