Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
/ TreeTransform Public archive

Convert an adjacency list to a nested set adjacency list combo.

Notifications You must be signed in to change notification settings

jnewman/TreeTransform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeTransform

Here is the TreeTransform package. Really it's just a class and a quick example. Ported from the answer to this StackOverflow question: http://goo.gl/J60wf Here are my ridiculous assumptions:

  1. RedBeanPHP is configured to use the R facade.
  2. The targeted TABLE contains a properly formed adjacency list with `parent` being the column name of the self-join foreign key.
  3. TABLE contains two, otherwise unused, integer columns named `lft` * and `rht` (e.g., table contains contains, at least, these fields:
    
     CREATE TABLE IF NOT EXISTS `adjacency_nested_combo` (
             `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
             `parent` int(11) unsigned DEFAULT NULL,
             `lft` int(10) unsigned NOT NULL,
             `rht` int(10) unsigned NOT NULL,
         PRIMARY KEY (`id`)
         ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
     
    </li>
    

If you want to try it out just do the following:

  1. Create a database and fill with the example data.
  2. Configure ./config/config.php (you need your password and databasename).

Hope this turns out to be useful.

About

Convert an adjacency list to a nested set adjacency list combo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages