Class creocoder\nestedsets\NestedSetsBehavior
Inheritance | creocoder\nestedsets\NestedSetsBehavior » yii\base\Behavior |
---|
NestedSetsBehavior
Public Properties
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$node | \yii\db\ActiveRecord|null | creocoder\nestedsets\NestedSetsBehavior | |
$operation | string|null | creocoder\nestedsets\NestedSetsBehavior |
Public Methods
Protected Methods
Constants
Constant | Value | Description | Defined 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
Method Details
public void afterDelete ( ) |
public void afterInsert ( ) | ||
throws | \yii\db\Exception |
---|
public void afterUpdate ( ) |
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 |
protected void applyTreeAttributeCondition ( <b>&</b>$condition ) | ||
$condition | array |
public void beforeDelete ( ) | ||
throws | \yii\db\Exception | |
---|---|---|
throws | \yii\base\NotSupportedException |
public void beforeInsert ( ) | ||
throws | \yii\base\NotSupportedException |
---|
protected void beforeInsertNode ( $value, $depth ) | ||
$value | integer | |
$depth | integer | |
throws | \yii\db\Exception |
---|
protected void beforeInsertRootNode ( ) | ||
throws | \yii\db\Exception |
---|
public void beforeUpdate ( ) | ||
throws | \yii\db\Exception |
---|
Gets the children of the node.
public \yii\db\ActiveQuery children ( $depth = null ) | ||
$depth | integer|null | The depth |
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 |
protected integer|false deleteWithChildrenInternal ( ) | ||
return | integer|false | The number of rows deleted or false if the deletion is unsuccessful for some reason. |
---|
public void events ( ) |
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 |
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 |
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 |
---|
Determines whether the node is leaf.
public boolean isLeaf ( ) | ||
return | boolean | Whether the node is leaf |
---|
Determines whether the node is root.
public boolean isRoot ( ) | ||
return | boolean | Whether the node is root |
---|
Gets the leaves of the node.
public \yii\db\ActiveQuery leaves ( ) |
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 |
protected void moveNode ( $value, $depth ) | ||
$value | integer | |
$depth | integer |
protected void moveNodeAsRoot ( ) |
Gets the next sibling of the node.
public \yii\db\ActiveQuery next ( ) |
Gets the parents of the node.
public \yii\db\ActiveQuery parents ( $depth = null ) | ||
$depth | integer|null | The depth |
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 |
Gets the previous sibling of the node.
public \yii\db\ActiveQuery prev ( ) |
protected void shiftLeftRightAttribute ( $value, $delta ) | ||
$value | integer | |
$delta | integer |