Simple PHP ORM for tree data structures

dev-master 2017-01-27 17:16 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:08:21 UTC


README

Simple PHP ORM for tree data structures

  1. Build your data object inheriting one of predefined DataObject types: alt tag

  2. Connect your data objects to form tree structure

  3. Save the tree to database

  4. Load the tree starting from the node you choose to the depth you choose

install with composer

"require": {
      "the-great-wizard/o-tree": "dev-master"
  }

Example

// database connection configurations
define('DB_NAME', 'your_mysql_DB');
define('DB_USER', 'your_mysql_user');
define('DB_PASSWORD', 'your_mysql_password');
define('DB_HOST', '127.0.0.1');

// build an object that inherit DataObject. 
$obj = new \DAL\DummyDataObject();
var_dump($obj);

// get database handle
$hld = new \DAL\HighLevelDAL();

// save the data object to database
$hld->saveDataObject($obj, 1);

// load the data object from database
$loadedObj = $hld->loadDataObject($obj->getCombinedId(), 1);
var_dump($loadedObj);