Giter Site home page Giter Site logo

phalcon-nested-sets's Introduction

FOSSA Status

Nested Set Behaviour

Phalcon implementation for tree / hierarchy through nested sets implementation. It will calculate edges and depth for a category on creation, update and delete.

Moving "branches" is not supported (o sub-node with all it's sub-nodes) and won't be. This tool is meant to "react" to changes on a single record and keep the rest of the tree position in place.

prerequisites

Your DB must have parent, left, right, depth columns. Example:

CREATE TABLE `categories` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` CHAR(50) NULL DEFAULT NULL,
	`parent_id` INT(11) NULL DEFAULT NULL,
	`_left` INT(11) NULL DEFAULT NULL,
	`_right` INT(11) NULL DEFAULT NULL,
	`_depth` INT(11) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
);

usage

class MyModel extends \Phalcon\Mvc\Model {
    public function initialize() {
        $this->addBehaviour(new \P4BGroup\NestedSets\Behaviour());
    }
}

references

usage

this behaviour will automatically calculate the edges and depth of each node on save / delete

Similar implementations on other frameworks

License

FOSSA Status

phalcon-nested-sets's People

Contributors

cfv1000 avatar fossabot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.