2017 © Pedro Pelรกez
 

kohana-module jam-materialized-path

Materialized path nesting for Jam ORM models

image

openbuildings/jam-materialized-path

Materialized path nesting for Jam ORM models

  • Monday, November 3, 2014
  • by hkdobrev
  • Repository
  • 9 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Jam Materialized Path

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

Materialized path nesting for Jam ORM models, (*2)

Usage

Add this behaviors your Model, (*3)

class Model_Category extends Jam_Model {

    public static function initialize(Jam_Meta $meta)
    {
        $meta
            ->behaviors(array(
                'materializedpath' => Jam::behavior('materializedpath')
            ));
    }
}

Database Table:, (*4)

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

Methods

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

Method Description
decendents() Get a query builder collection for all the decendents
ansestors() Get a query builder collection for all the ansestors
is_root() Boolean check if it is root (has parent) or not
is_descendent_of(Jam_Model $parent) Chech if a model is descendant
is_ansestor_of(Jam_Model $child) Chech if model is ansestor
depth() The depth of the item in the hierarchy

License

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

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

The Versions

03/11 2014

dev-master

9999999-dev

Materialized path nesting for Jam ORM models

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

03/11 2014

0.1.0

0.1.0.0

Materialized path nesting for Jam ORM models

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires