2017 © Pedro Peláez
 

library nested-set

A PHP Doctrine DBAL implementation for Nested Sets.

image

previousnext/nested-set

A PHP Doctrine DBAL implementation for Nested Sets.

  • Monday, August 21, 2017
  • by kimpepper
  • Repository
  • 5 Watchers
  • 7 Stars
  • 21,302 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 6 Versions
  • 15 % Grown

The README.md

Nested Set

A PHP Doctrine DBAL implementation for Nested Sets., (*1)

CircleCI, (*2)

Using

Create table schema

Create the table schema, passing in a a DBAL connection and table name (defaults to 'tree')., (*3)

$schema = new DbalNestedSetSchema($connection, 'my_tree');
schema->create();

Set up the nested set client

Create a new DbalNestedSet passing in the DBAL connection and the table name., (*4)

$nestedSet = new DbalNestedSet($connection, 'my_tree');

Add a root node

A NodeKey represents a unique ID for a node in the tree. It supports the idea of a node ID and a revision ID, mostly for compatibility with Drupal., (*5)

$nodeKey = new NodeKey($id, $revisionId);
$rootNode = $nestedSet->addRootNode($nodeKey);

Add a child node

To add a child node, you provide the parent node, and a child node key., (*6)

$nodeKey = new NodeKey($id, $revisionId);
$nestedSet->addNodeBelow($rootNode, $nodeKey);

Find Descendants

To find descendents, you provide the parent node key., (*7)

$nodeKey = new NodeKey($id, $revisionId);
$descendants = $this->nestedSet->findDescendants($nodeKey);

Find ancestors

To find ancestors, you provide the child node key., (*8)

$nodeKey = new NodeKey($id, $revisionId);
$ancestors = $this->nestedSet->findAncestors($nodeKey);

See \PNX\NestedSet\NestedSetInterface for many more methods that can be used for interacting with the nested set., (*9)

Developing

Dependencies

To install all dependencies, run:, (*10)

make init

Linting

Uses the Drupal coding standard., (*11)

To validate code sniffs run:, (*12)

make lint-php

To automatically fix code sniff issues, run:, (*13)

make fix-php

Testing

To run all phpunit tests, run:, (*14)

make test

The Versions

21/08 2017

dev-node-key-only

dev-node-key-only

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper

16/08 2017

dev-master

9999999-dev

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper

16/08 2017

0.1.1

0.1.1.0

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper

27/07 2017

0.1.0

0.1.0.0

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper

30/05 2017

dev-more-indexes

dev-more-indexes

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper

15/02 2017

0.0.1

0.0.1.0

A PHP Doctrine DBAL implementation for Nested Sets.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Kim Pepper