2017 © Pedro Pelรกez
 

library nested

Adjacency List (parentId column) for Harp ORM

image

harp-orm/nested

Adjacency List (parentId column) for Harp ORM

  • Monday, July 14, 2014
  • by hkdobrev
  • Repository
  • 2 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Nested

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version, (*1)

Adjacency List (parentId column) for Harp ORM, (*2)

Usage

Add the Trait to your Model, (*3)

// Model Class
use Harp\Nested\NestedTrait;

class Category extends AbstractModel
{
    use NestedTrait;

    public static function initialize($config)
    {
        NestedTrait::initialize($config);

        // Other initializations
        // ...
    }
}

Database Table:, (*4)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Table: Category         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id          โ”‚ ingeter   โ”‚
โ”‚ name        โ”‚ string    โ”‚
โ”‚ parentId*   โ”‚ integer   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
* Required fields

Methods

It will add "parent" and "children" Rels to the repo. The model will get the convenience methods:, (*5)

Method Description
getParent() Return the parent model
setParent(AbstractModel $parent) Set the parent model
getChildren() Get immidiate children. Returns a Models object
isRoot() Boolean check if it is root (has parent) or not
getParents() Return all the parents, including root. Models object

License

Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin, (*6)

Under BSD-3-Clause license, read LICENSE file., (*7)

The Versions

14/07 2014

dev-master

9999999-dev

Adjacency List (parentId column) for Harp ORM

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

14/07 2014

0.3.0

0.3.0.0

Adjacency List (parentId column) for Harp ORM

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

09/07 2014

0.2.0

0.2.0.0

Adjacency List (parentId column) for Harp ORM

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

26/06 2014

0.1.0

0.1.0.0

Adjacency List (parentId column) for Harp ORM

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires