PHP Class Xpressengine\Support\Tree\Node

Author: XE Developers ([email protected])
Inheritance: extends Xpressengine\Database\Eloquent\DynamicModel, implements Xpressengine\Support\Tree\NodeInterface, use trait TreeMakerTrait
Mostra file Open project: xpressengine/xpressengine Class Usage Examples

Protected Properties

Property Type Description
$children Illuminate\Database\Eloquent\Collection children collection of model
$parent Xpressengine\Support\Tree\NodeInterface

Public Methods

Method Description
addChild ( Xpressengine\Support\Tree\NodeInterface $node ) : void Add child node
aggregator ( ) : BelongsTo Aggregator relationship
ancestors ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Ancestors relationship
descendants ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Descendants relationship
getAggregatorKeyName ( ) : string Get the aggregator key name for model
getAggregatorModel ( ) : string Get the aggregator model name for model
getAncestorName ( ) : string Get the ancestor key name of pivot table
getBreadcrumbs ( ) : array Get primary key array for breadcrumbs
getChildren ( ) : Illuminate\Database\Eloquent\Collection Get a children collection of model
getClosureTable ( ) : string Get the pivot table for model's hierarchy
getDepth ( ) : integer Get the depth value of model
getDepthName ( ) : string Get the depth key name of pivot table
getDescendantCount ( ) : integer Returns a number of descendants
getDescendantName ( ) : string Get the descendant key name of pivot table
getDescendantTree ( boolean $withSelf = false ) : Tree Get a descendant tree collection of model
getNodeIdentifier ( ) : string | integer Get the unique identifier for the node
getNodeIdentifierName ( ) : string Get the unique identifier name for the node
getParent ( ) : Node | static Get a model's parent node
getParentIdName ( ) : string Get the parent key name for model
getParentNodeIdentifier ( ) : string | integer Get the parent identifier for the node
hasChild ( ) : boolean Check having child and return the boolean result.
scopeProgenitors ( Builder $query, Aggregator $aggregator ) : Builder Scope for get node items of progenitor
scopeRoots ( Builder $query ) : Builder Scope for get node items of root
setChildren ( Xpressengine\Support\Tree\NodeInterface[] $children = [] ) : void Set child nodes
setParent ( Xpressengine\Support\Tree\NodeInterface $node ) : void Set parent node

Protected Methods

Method Description
children ( ) : Illuminate\Database\Eloquent\Collection Returns children collection

Method Details

addChild() public method

Add child node
public addChild ( Xpressengine\Support\Tree\NodeInterface $node ) : void
$node Xpressengine\Support\Tree\NodeInterface child node
return void

aggregator() public method

Aggregator relationship
public aggregator ( ) : BelongsTo
return Illuminate\Database\Eloquent\Relations\BelongsTo

ancestors() public method

Ancestors relationship
public ancestors ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
return Illuminate\Database\Eloquent\Relations\BelongsToMany

children() protected method

Returns children collection
protected children ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

descendants() public method

Descendants relationship
public descendants ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
return Illuminate\Database\Eloquent\Relations\BelongsToMany

getAggregatorKeyName() abstract public method

Get the aggregator key name for model
abstract public getAggregatorKeyName ( ) : string
return string

getAggregatorModel() abstract public method

Get the aggregator model name for model
abstract public getAggregatorModel ( ) : string
return string

getAncestorName() abstract public method

Get the ancestor key name of pivot table
abstract public getAncestorName ( ) : string
return string

getBreadcrumbs() public method

Get primary key array for breadcrumbs
public getBreadcrumbs ( ) : array
return array

getChildren() public method

Get a children collection of model
public getChildren ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

getClosureTable() abstract public method

Get the pivot table for model's hierarchy
abstract public getClosureTable ( ) : string
return string

getDepth() public method

Get the depth value of model
public getDepth ( ) : integer
return integer

getDepthName() abstract public method

Get the depth key name of pivot table
abstract public getDepthName ( ) : string
return string

getDescendantCount() public method

Returns a number of descendants
public getDescendantCount ( ) : integer
return integer

getDescendantName() abstract public method

Get the descendant key name of pivot table
abstract public getDescendantName ( ) : string
return string

getDescendantTree() public method

Get a descendant tree collection of model
public getDescendantTree ( boolean $withSelf = false ) : Tree
$withSelf boolean flag for descendant tree with self
return Tree

getNodeIdentifier() public method

Get the unique identifier for the node
public getNodeIdentifier ( ) : string | integer
return string | integer

getNodeIdentifierName() public method

Get the unique identifier name for the node
public getNodeIdentifierName ( ) : string
return string

getParent() public method

Get a model's parent node
public getParent ( ) : Node | static
return Node | static

getParentIdName() abstract public method

Get the parent key name for model
abstract public getParentIdName ( ) : string
return string

getParentNodeIdentifier() public method

Get the parent identifier for the node

hasChild() public method

Check having child and return the boolean result.
public hasChild ( ) : boolean
return boolean

scopeProgenitors() public method

Scope for get node items of progenitor
public scopeProgenitors ( Builder $query, Aggregator $aggregator ) : Builder
$query Illuminate\Database\Eloquent\Builder query builder
$aggregator Aggregator category instance
return Illuminate\Database\Eloquent\Builder

scopeRoots() public method

Scope for get node items of root
public scopeRoots ( Builder $query ) : Builder
$query Illuminate\Database\Eloquent\Builder query builder
return Illuminate\Database\Eloquent\Builder

setChildren() public method

Set child nodes
public setChildren ( Xpressengine\Support\Tree\NodeInterface[] $children = [] ) : void
$children Xpressengine\Support\Tree\NodeInterface[] children node interfaces
return void

setParent() public method

Set parent node
public setParent ( Xpressengine\Support\Tree\NodeInterface $node ) : void
$node Xpressengine\Support\Tree\NodeInterface parent node
return void

Property Details

$children protected_oe property

children collection of model
protected Collection,Illuminate\Database\Eloquent $children
return Illuminate\Database\Eloquent\Collection

$parent protected_oe property

protected NodeInterface,Xpressengine\Support\Tree $parent
return Xpressengine\Support\Tree\NodeInterface