boomcms/orm-mptt

There is no license information available for the latest version (v3.3.0) of this package.

v3.3.0 2014-11-03 10:20 UTC

This package is auto-updated.

Last update: 2021-08-29 01:17:54 UTC


README

Setup

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

Declaring your ORM object

class Model_Category extends ORM_MPTT {
}

Usage Examples

Creating a root node:

$cat = ORM::factory('Category_Mptt');
$cat->name = 'Music';
$cat->insert_as_new_root();
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';
$cat->insert_as_last_child($c1);