boomcms / orm-mptt
Installs: 522
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 23
pkg:composer/boomcms/orm-mptt
Requires
- kohana/orm: 3.3.*
This package is auto-updated.
Last update: 2025-09-29 01:37:31 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);