PHP Class Baum\SetBuilder

Mostra file Open project: gazsp/baum Class Usage Examples

Protected Properties

Property Type Description
$bounds array Array which will hold temporary lft, rgt index values for each scope.
$node Node Node instance for reference.

Public Methods

Method Description
__construct ( Node $node ) : void Create a new \Baum\SetBuilder class instance.
children ( Baum\Node $node ) : Illuminate\Database\Eloquent\Collection Return all children for the specified node.
rebuild ( ) : void Perform the re-calculation of the left and right indexes of the whole nested set tree structure.
rebuildBounds ( $node, $depth ) Recompute left and right index bounds for the specified node and its children (recursive call). Fill the depth column too.
roots ( ) : Illuminate\Database\Eloquent\Collection Return all root nodes for the current database table appropiately sorted.

Protected Methods

Method Description
getNextBound ( string $key ) : integer Return next index bound value for the given key (current scope identifier).
qualify ( $column ) : string Get the fully qualified value for the specified column.
scopedAttributes ( Baum\Node $node ) : array Return an array of the scoped attributes of the supplied node.
scopedKey ( Baum\Node $node ) : string Return a string-key for the current scoped attributes. Used for index computing when a scope is defined (acsts as an scope identifier).

Method Details

__construct() public method

Create a new \Baum\SetBuilder class instance.
public __construct ( Node $node ) : void
$node Node
return void

children() public method

Return all children for the specified node.
public children ( Baum\Node $node ) : Illuminate\Database\Eloquent\Collection
$node Baum\Node
return Illuminate\Database\Eloquent\Collection

getNextBound() protected method

Return next index bound value for the given key (current scope identifier).
protected getNextBound ( string $key ) : integer
$key string
return integer

qualify() protected method

Get the fully qualified value for the specified column.
protected qualify ( $column ) : string
return string

rebuild() public method

Perform the re-calculation of the left and right indexes of the whole nested set tree structure.
public rebuild ( ) : void
return void

rebuildBounds() public method

Recompute left and right index bounds for the specified node and its children (recursive call). Fill the depth column too.
public rebuildBounds ( $node, $depth )

roots() public method

Return all root nodes for the current database table appropiately sorted.
public roots ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

scopedAttributes() protected method

Return an array of the scoped attributes of the supplied node.
protected scopedAttributes ( Baum\Node $node ) : array
$node Baum\Node
return array

scopedKey() protected method

Return a string-key for the current scoped attributes. Used for index computing when a scope is defined (acsts as an scope identifier).
protected scopedKey ( Baum\Node $node ) : string
$node Baum\Node
return string

Property Details

$bounds protected_oe property

Array which will hold temporary lft, rgt index values for each scope.
protected array $bounds
return array

$node protected_oe property

Node instance for reference.
protected Node,Baum $node
return Node