NestedSetDbTable is a abstract class that provides API for managing
some table which has data that is organized in "Nested set model"
Developers should extend this class in order to use its functionality.
Properties $_name (name of the table), $_primary (name of the primary key),
$_left (left column name in nested table) and $_right (right column name
in nested table) must be overrriden in the extending class and filled with
PDO instance must be supplied to the object of this class in order to
Nikola Posa <email@example.com>
1. You should put folder, in which you've stored NestedSetDbTable dir, in
the include path. Here's an example of how to do that:
set_include_path('.' . PATH_SEPARATOR . 'path/to/libs'
. PATH_SEPARATOR . get_include_path());
... where "libs" is name of the folder where you've stored NestedSetDbTable dir.
* API for managing database table, which has data that is organized
in "Nested set model" manner,
* Methods for implementing Nested set model,
* getTree() method gets whole tree, including depth information,
* insert() method enables adding new node at desired position in
* updateNode() method enables updating data of some node, including
its position in tree hierarchy,
* deleteNode() method is used for deleting nodes, and it has option
for deleting only desired node (without its child nodes), or
deleting its child nodes as well
class Categories extends NestedSetDbTable_Abstract
protected $_name = 'categories';
protected $_primary = 'id';
protected $_left = 'left';
protected $_right = 'right';
$pdo = new PDO('mysql:dbname=test;host=127.0.0.1', 'root', '');
//Setting db adapter for all instances of NestedSetDbTable_Abstract class:
$categories = new Categories();
NestedSetDbTable package requires PHP 5 or later, with enabled PDO extension.
The files in this archive are released under the GNU General Public License.
You can find a copy of this license in LICENSE.txt.