Class creocoder\nestedsets\NestedSetsBehavior

Inheritancecreocoder\nestedsets\NestedSetsBehavior » yii\base\Behavior

NestedSetsBehavior

Public Methods

Hide inherited methods

MethodDescriptionDefined By
afterDelete() creocoder\nestedsets\NestedSetsBehavior
afterInsert() creocoder\nestedsets\NestedSetsBehavior
afterUpdate() creocoder\nestedsets\NestedSetsBehavior
appendTo() Creates a node as the last child of the target node if the active record is new or moves it as the last child of the target node. creocoder\nestedsets\NestedSetsBehavior
beforeDelete() creocoder\nestedsets\NestedSetsBehavior
beforeInsert() creocoder\nestedsets\NestedSetsBehavior
beforeUpdate() creocoder\nestedsets\NestedSetsBehavior
children() Gets the children of the node. creocoder\nestedsets\NestedSetsBehavior
deleteWithChildren() Deletes a node and its children. creocoder\nestedsets\NestedSetsBehavior
events() creocoder\nestedsets\NestedSetsBehavior
insertAfter() Creates a node as the next sibling of the target node if the active record is new or moves it as the next sibling of the target node. creocoder\nestedsets\NestedSetsBehavior
insertBefore() Creates a node as the previous sibling of the target node if the active record is new or moves it as the previous sibling of the target node. creocoder\nestedsets\NestedSetsBehavior
isChildOf() Determines whether the node is child of the parent node. creocoder\nestedsets\NestedSetsBehavior
isLeaf() Determines whether the node is leaf. creocoder\nestedsets\NestedSetsBehavior
isRoot() Determines whether the node is root. creocoder\nestedsets\NestedSetsBehavior
leaves() Gets the leaves of the node. creocoder\nestedsets\NestedSetsBehavior
makeRoot() Creates the root node if the active record is new or moves it as the root node. creocoder\nestedsets\NestedSetsBehavior
next() Gets the next sibling of the node. creocoder\nestedsets\NestedSetsBehavior
parents() Gets the parents of the node. creocoder\nestedsets\NestedSetsBehavior
prependTo() Creates a node as the first child of the target node if the active record is new or moves it as the first child of the target node. creocoder\nestedsets\NestedSetsBehavior
prev() Gets the previous sibling of the node. creocoder\nestedsets\NestedSetsBehavior

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
OPERATION_APPEND_TO 'appendTo' creocoder\nestedsets\NestedSetsBehavior
OPERATION_DELETE_WITH_CHILDREN 'deleteWithChildren' creocoder\nestedsets\NestedSetsBehavior
OPERATION_INSERT_AFTER 'insertAfter' creocoder\nestedsets\NestedSetsBehavior
OPERATION_INSERT_BEFORE 'insertBefore' creocoder\nestedsets\NestedSetsBehavior
OPERATION_MAKE_ROOT 'makeRoot' creocoder\nestedsets\NestedSetsBehavior
OPERATION_PREPEND_TO 'prependTo' creocoder\nestedsets\NestedSetsBehavior

Property Details

$depthAttribute public property
public string $depthAttribute 'depth'
$leftAttribute public property
public string $leftAttribute 'lft'
$node protected property
protected \yii\db\ActiveRecord|null $node null
$operation protected property
protected string|null $operation null
$rightAttribute public property
public string $rightAttribute 'rgt'
$treeAttribute public property
public string|false $treeAttribute false

Method Details

afterDelete() public method

public void afterDelete ( )
afterInsert() public method

public void afterInsert ( )
throws \yii\db\Exception
afterUpdate() public method

public void afterUpdate ( )
appendTo() public method

Creates a node as the last child of the target node if the active record is new or moves it as the last child of the target node.

public boolean appendTo ( $node, $runValidation true, $attributes null )
$node \yii\db\ActiveRecord
$runValidation boolean
$attributes array
applyTreeAttributeCondition() protected method

protected void applyTreeAttributeCondition ( &$condition )
$condition array
beforeDelete() public method

public void beforeDelete ( )
throws \yii\db\Exception
throws \yii\base\NotSupportedException
beforeInsert() public method

public void beforeInsert ( )
throws \yii\base\NotSupportedException
beforeInsertNode() protected method

protected void beforeInsertNode ( $value, $depth )
$value integer
$depth integer
throws \yii\db\Exception
beforeInsertRootNode() protected method

protected void beforeInsertRootNode ( )
throws \yii\db\Exception
beforeUpdate() public method

public void beforeUpdate ( )
throws \yii\db\Exception
children() public method

Gets the children of the node.

public \yii\db\ActiveQuery children ( $depth null )
$depth integer|null

The depth

deleteWithChildren() public method

Deletes a node and its children.

public integer|false deleteWithChildren ( )
return integer|false

The number of rows deleted or false if the deletion is unsuccessful for some reason.

throws Exception
deleteWithChildrenInternal() protected method

protected integer|false deleteWithChildrenInternal ( )
return integer|false

The number of rows deleted or false if the deletion is unsuccessful for some reason.

events() public method

public void events ( )
insertAfter() public method

Creates a node as the next sibling of the target node if the active record is new or moves it as the next sibling of the target node.

public boolean insertAfter ( $node, $runValidation true, $attributes null )
$node \yii\db\ActiveRecord
$runValidation boolean
$attributes array
insertBefore() public method

Creates a node as the previous sibling of the target node if the active record is new or moves it as the previous sibling of the target node.

public boolean insertBefore ( $node, $runValidation true, $attributes null )
$node \yii\db\ActiveRecord
$runValidation boolean
$attributes array
isChildOf() public method

Determines whether the node is child of the parent node.

public boolean isChildOf ( $node )
$node \yii\db\ActiveRecord

The parent node

return boolean

Whether the node is child of the parent node

isLeaf() public method

Determines whether the node is leaf.

public boolean isLeaf ( )
return boolean

Whether the node is leaf

isRoot() public method

Determines whether the node is root.

public boolean isRoot ( )
return boolean

Whether the node is root

leaves() public method

Gets the leaves of the node.

public \yii\db\ActiveQuery leaves ( )
makeRoot() public method

Creates the root node if the active record is new or moves it as the root node.

public boolean makeRoot ( $runValidation true, $attributes null )
$runValidation boolean
$attributes array
moveNode() protected method

protected void moveNode ( $value, $depth )
$value integer
$depth integer
moveNodeAsRoot() protected method

protected void moveNodeAsRoot ( )
next() public method

Gets the next sibling of the node.

public \yii\db\ActiveQuery next ( )
parents() public method

Gets the parents of the node.

public \yii\db\ActiveQuery parents ( $depth null )
$depth integer|null

The depth

prependTo() public method

Creates a node as the first child of the target node if the active record is new or moves it as the first child of the target node.

public boolean prependTo ( $node, $runValidation true, $attributes null )
$node \yii\db\ActiveRecord
$runValidation boolean
$attributes array
prev() public method

Gets the previous sibling of the node.

public \yii\db\ActiveQuery prev ( )
shiftLeftRightAttribute() protected method

protected void shiftLeftRightAttribute ( $value, $delta )
$value integer
$delta integer