PHP Classes

Nested Set DB Table: Manage nested sets of data stored in a database

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (5)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 56%Total: 908 This week: 1All time: 3,907 This week: 571Up
Version License PHP version Categories
nested-set-db-table 2.0GNU General Publi...5.0PHP 5, Databases, Data types
Description 

Author

This package can be used to manage nested sets of data stored in a database.

It can create and manage an hierarchy of nodes in a database table allowing to retrieve, add, update and delete nodes.

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 appropriate values.

PDO instance must be supplied to the object of this class in order to use it.

Picture of Nikola Posa
Name: Nikola Posa <contact>
Classes: 4 packages by
Country: ???
Age: ???
All time rank: 956
Week rank: 420 Up

Details

NestedSetDbTable is a abstract class that provides API for managing some table which has data that is organized in "Nested set model" manner. 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 appropriate values. PDO instance must be supplied to the object of this class in order to use it. AUTHOR ------ Nikola Posa <posa.nikola@gmail.com> INSTALLATION ------------ 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. FEATURES -------- * 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 tree hierarchy, * 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 USAGE ----- 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: NestedSetDbTable_Abstract::setDefaultAdapter($pdo); $categories = new Categories(); print_r($categories->getTree()); SYSTEM REQUIREMENTS ------------------- NestedSetDbTable package requires PHP 5 or later, with enabled PDO extension. LICENSE ------- The files in this archive are released under the GNU General Public License. You can find a copy of this license in LICENSE.txt.

  Files folder image Files  
File Role Description
Files folder imagelibs (1 directory)
Accessible without login Plain text file LICENSE.txt Lic. License file.
Accessible without login Plain text file README.txt Doc. Readme file.

  Files folder image Files  /  libs  
File Role Description
Files folder imageNestedSetDbTable (2 files)

  Files folder image Files  /  libs  /  NestedSetDbTable  
File Role Description
  Accessible without login Plain text file Abstract.php Class Abstract class that provides API for managing Nested set database table.
  Accessible without login Plain text file Exception.php Class Exception in NestedSetDbTable package

 Version Control Unique User Downloads Download Rankings  
 0%
Total:908
This week:1
All time:3,907
This week:571Up
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:66%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:56%StarStarStar
Rank:1758