Class kartik\tree\models\Tree

Inheritancekartik\tree\models\Tree » yii\db\ActiveRecord » yii\db\BaseActiveRecord » yii\base\Model » yii\base\Component » yii\base\BaseObject
ImplementsArrayAccess, IteratorAggregate, yii\base\Arrayable, yii\base\Configurable, yii\base\StaticInstanceInterface, yii\db\ActiveRecordInterface
Uses Traitskartik\tree\models\TreeTrait, yii\base\ArrayableTrait, yii\base\StaticInstanceTrait

This is the base model class for the nested set tree structure. To use this in your project, create your model for storing the tree structure extending the kartik\tree\models\Tree model. You can alternatively build your own model extending from yii\db\ActiveRecord but modify it to use the kartik\tree\models\TreeTrait.

You must provide the table name in the model. Optionally, you can add rules, or edit the various methods like isVisible(), isDisabled() etc. to identify allowed flags for nodes.

For example,

namespace frontend\models;

use Yii;

class Tree extends \kartik\tree\models\Tree
{

    public static function tableName()
    {
        return 'tbl_tree';
    }
}

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$active boolean whether the node is active kartik\tree\models\Tree
$activeOrig boolean Attribute to cache the active state before a model update. kartik\tree\models\Tree
$activeValidators yii\validators\Validator[] The validators applicable to the current $scenario. yii\base\Model
$attributes array Attribute values (name => value). yii\base\Model
$behaviors yii\base\Behavior[] List of behaviors attached to this component. yii\base\Component
$boolAttribs array The list of boolean value attributes kartik\tree\models\TreeTrait
$breadcrumbs string The parsed breadcrumbs kartik\tree\models\TreeTrait
$collapsed boolean whether the node is collapsed kartik\tree\models\Tree
$dirtyAttributes array The changed attribute values (name-value pairs). yii\db\BaseActiveRecord
$disabled boolean whether the node is disabled kartik\tree\models\Tree
$encodeNodeNames boolean Whether to HTML encode the tree node names. kartik\tree\models\Tree
$errors array Errors for all attributes or the specified attribute. Empty array is returned if no error. See getErrors() for detailed description. Note that when returning errors for all attributes, the result is a two-dimensional array, like the following: `php [ 'username' => [ 'Username is required.', 'Username must contain only word characters.', ], 'email' => [ 'Email address is invalid.', ] ] ` . yii\base\Model
$falseAttribs array The default list of boolean attributes with initial value = false kartik\tree\models\TreeTrait
$firstErrors array The first errors. The array keys are the attribute names, and the array values are the corresponding error messages. An empty array will be returned if there is no error. yii\base\Model
$icon string the icon to be displayed for the node kartik\tree\models\Tree
$icon_type integer the icon type (whether CSS or raw image) kartik\tree\models\Tree
$id integer|string the node identifier kartik\tree\models\Tree
$isNewRecord boolean Whether the record is new and should be inserted when calling save(). yii\db\BaseActiveRecord
$iterator ArrayIterator An iterator for traversing the items in the list. yii\base\Model
$lft integer the node nested set left value kartik\tree\models\Tree
$lvl integer the node depth level kartik\tree\models\Tree
$movable_d boolean whether the node is movable down (sibling) kartik\tree\models\Tree
$movable_l boolean whether the node is movable one level up (parent) to the left kartik\tree\models\Tree
$movable_r boolean whether the node is movable one level down (child) to the right kartik\tree\models\Tree
$movable_u boolean whether the node is movable up (sibling) kartik\tree\models\Tree
$name string the name for identifying the current node record kartik\tree\models\Tree
$nodeActivationErrors array Activation errors for the node. kartik\tree\models\Tree
$nodeRemovalErrors array Node removal errors. kartik\tree\models\Tree
$oldAttributes array The old attribute values (name-value pairs). Note that the type of this property differs in getter and setter. See getOldAttributes() and setOldAttributes() for details. yii\db\BaseActiveRecord
$oldPrimaryKey mixed The old primary key value. An array (column name => column value) is returned if the primary key is composite. A string is returned otherwise (null will be returned if the key value is null). yii\db\BaseActiveRecord
$primaryKey mixed The primary key value. An array (column name => column value) is returned if the primary key is composite. A string is returned otherwise (null will be returned if the key value is null). yii\db\BaseActiveRecord
$purifyNodeIcons boolean Whether to HTML purify the tree node icon content before saving. kartik\tree\models\Tree
$readonly boolean whether the node is readonly kartik\tree\models\Tree
$relatedRecords array An array of related records indexed by relation names. yii\db\BaseActiveRecord
$removable boolean whether the node is removable kartik\tree\models\Tree
$removable_all boolean whether the node and all its children are removable kartik\tree\models\Tree
$rgt integer the node nested set right value kartik\tree\models\Tree
$root integer the node root identifier kartik\tree\models\Tree
$scenario string The scenario that this model is in. Defaults to SCENARIO_DEFAULT. yii\base\Model
$selected boolean whether the node is selected kartik\tree\models\Tree
$treeQueryClass string The classname for the TreeQuery that implements the NestedSetQueryBehavior. kartik\tree\models\Tree
$validators ArrayObject|yii\validators\Validator[] All the validators declared in the model. yii\base\Model
$visible boolean whether the node is visible kartik\tree\models\Tree

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Component
__clone() This method is called after the object is created by cloning an existing one. yii\base\Model
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of a component property. yii\base\Component
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Component
__set() Sets the value of a component property. yii\base\Component
__unset() Sets a component property to be null. yii\base\Component
activateNode() Activates a node (for undoing a soft deletion scenario) kartik\tree\models\TreeTrait
activeAttributes() Returns the attribute names that are subject to validation in the current scenario. yii\base\Model
addError() Adds a new error to the specified attribute. yii\base\Model
addErrors() Adds a list of errors. yii\base\Model
afterDelete() This method is invoked after deleting a record. yii\db\BaseActiveRecord
afterFind() This method is called when the AR object is created and populated with the query result. yii\db\BaseActiveRecord
afterRefresh() This method is called when the AR object is refreshed. yii\db\BaseActiveRecord
afterSave() This method is called at the end of inserting or updating a record. yii\db\BaseActiveRecord
afterValidate() This method is invoked after validation ends. yii\base\Model
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. kartik\tree\models\Tree
attachBehavior() Attaches a behavior to this component. yii\base\Component
attachBehaviors() Attaches a list of behaviors to the component. yii\base\Component
attributeHints() Returns the attribute hints. yii\base\Model
attributeLabels() Returns the attribute labels. kartik\tree\models\TreeTrait
attributes() Returns the list of all attribute names of the model. yii\db\ActiveRecord
beforeDelete() This method is invoked before deleting a record. yii\db\BaseActiveRecord
beforeSave() This method is called at the beginning of inserting or updating a record. yii\db\BaseActiveRecord
beforeValidate() This method is invoked before validation starts. yii\base\Model
behaviors() Returns a list of behaviors that this component should behave as. kartik\tree\models\TreeTrait
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Component
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Component
children() Gets the children of the node. kartik\tree\models\Tree
className() Returns the fully qualified name of this class. yii\base\BaseObject
clearErrors() Removes errors for all attributes or a single attribute. yii\base\Model
createQuery() Creates the query for the kartik\tree\models\Tree active record kartik\tree\models\TreeTrait
createValidators() Creates validator objects based on the validation rules specified in rules(). yii\base\Model
delete() Deletes the current node only. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason. kartik\tree\models\Tree
deleteAll() Deletes rows in the table using the provided conditions. yii\db\ActiveRecord
deleteWithChildren() Deletes a node and its children. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason. kartik\tree\models\Tree
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component. yii\base\Component
equals() Returns a value indicating whether the given active record is the same as the current one. yii\db\ActiveRecord
extraFields() Returns the list of fields that can be expanded further and returned by toArray(). yii\base\ArrayableTrait
fields() Returns the list of fields that should be returned by default by toArray() when no specific fields are specified. yii\base\ArrayableTrait
find() Creates an kartik\tree\models\TreeQuery instance for query purpose. kartik\tree\models\TreeTrait
findAll() Returns a list of active record models that match the specified primary key value(s) or a set of column values. yii\db\BaseActiveRecord
findBySql() Creates an yii\db\ActiveQuery instance with a given SQL statement. yii\db\ActiveRecord
findOne() Returns a single active record model instance by a primary key or an array of column values. yii\db\BaseActiveRecord
formName() Returns the form name that this model class should use. yii\base\Model
generateAttributeLabel() Generates a user friendly attribute label based on the give attribute name. yii\base\Model
getActiveValidators() Returns the validators applicable to the current $scenario. yii\base\Model
getAttribute() Returns the named attribute value. yii\db\BaseActiveRecord
getAttributeHint() Returns the text hint for the specified attribute. yii\base\Model
getAttributeLabel() Returns the text label for the specified attribute. yii\base\Model
getAttributes() Returns attribute values. yii\base\Model
getBehavior() Returns the named behavior object. yii\base\Component
getBehaviors() Returns all behaviors attached to this component. yii\base\Component
getBreadcrumbs() Generate and return the breadcrumbs for the node. kartik\tree\models\TreeTrait
getDb() Returns the database connection used by this AR class. yii\db\ActiveRecord
getDirtyAttributes() Returns the attribute values that have been modified since they are loaded or saved most recently. yii\db\BaseActiveRecord
getErrorSummary() Returns the errors for all attributes as a one-dimensional array. yii\base\Model
getErrors() Returns the errors for all attributes or a single attribute. yii\base\Model
getFirstError() Returns the first error of the specified attribute. yii\base\Model
getFirstErrors() Returns the first error of every attribute in the model. yii\base\Model
getIsNewRecord() Returns a value indicating whether the current record is new. yii\db\BaseActiveRecord
getIterator() yii\base\Model
getOldAttribute() Returns the old value of the named attribute. yii\db\BaseActiveRecord
getOldAttributes() Returns the old attribute values. yii\db\BaseActiveRecord
getOldPrimaryKey() Returns the old primary key value(s). yii\db\BaseActiveRecord
getPrimaryKey() Returns the primary key value(s). yii\db\BaseActiveRecord
getRelatedRecords() Returns all populated related records. yii\db\BaseActiveRecord
getRelation() Returns the relation object with the specified name. yii\db\BaseActiveRecord
getScenario() Returns the scenario that this model is used in. yii\base\Model
getTableSchema() Returns the schema information of the DB table associated with this AR class. yii\db\ActiveRecord
getValidators() Returns all the validators declared in rules(). yii\base\Model
hasAttribute() Returns a value indicating whether the model has an attribute with the specified name. yii\db\BaseActiveRecord
hasErrors() Returns a value indicating whether there is any validation error. yii\base\Model
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event. yii\base\Component
hasMany() See yii\db\BaseActiveRecord::hasMany() for more info. yii\db\ActiveRecord
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasOne() See yii\db\BaseActiveRecord::hasOne() for more info. yii\db\ActiveRecord
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() Initializes the object. yii\base\BaseObject
initDefaults() Initialize default values kartik\tree\models\TreeTrait
insert() Inserts a row into the associated database table using the attribute values of this record. yii\db\ActiveRecord
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. kartik\tree\models\Tree
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. kartik\tree\models\Tree
instance() Returns static class instance, which can be used to obtain meta information. yii\base\StaticInstanceTrait
instantiate() Creates an active record instance. yii\db\BaseActiveRecord
isActive() Validate if the node is active kartik\tree\models\TreeTrait
isAttributeActive() Returns a value indicating whether the attribute is active in the current scenario. yii\base\Model
isAttributeChanged() Returns a value indicating whether the named attribute has been changed. yii\db\BaseActiveRecord
isAttributeRequired() Returns a value indicating whether the attribute is required. yii\base\Model
isAttributeSafe() Returns a value indicating whether the attribute is safe for massive assignments. yii\base\Model
isChildAllowed() Validate if the node can have children kartik\tree\models\TreeTrait
isChildOf() Determines whether the node is child of the parent node. kartik\tree\models\Tree
isCollapsed() Validate if the node is collapsed kartik\tree\models\TreeTrait
isDisabled() Validate if the node is disabled kartik\tree\models\TreeTrait
isLeaf() Determines whether the node is leaf. kartik\tree\models\Tree
isMovable() Validate if the node is movable kartik\tree\models\TreeTrait
isPrimaryKey() Returns a value indicating whether the given set of attributes represents the primary key for this model. yii\db\BaseActiveRecord
isReadonly() Validate if the node is readonly kartik\tree\models\TreeTrait
isRelationPopulated() Check whether the named relation has been populated with records. yii\db\BaseActiveRecord
isRemovable() Validate if the node is removable kartik\tree\models\TreeTrait
isRemovableAll() Validate if the node is removable with descendants kartik\tree\models\TreeTrait
isRoot() Determines whether the node is root. kartik\tree\models\Tree
isSelected() Validate if the node is selected kartik\tree\models\TreeTrait
isTransactional() Returns a value indicating whether the specified operation is transactional in the current $scenario. yii\db\ActiveRecord
isVisible() Validate if the node is visible kartik\tree\models\TreeTrait
leaves() Gets the leaves of the node. kartik\tree\models\Tree
link() Establishes the relationship between two models. yii\db\BaseActiveRecord
load() Populates the model with input data. yii\base\Model
loadDefaultValues() Loads default values from database table schema. yii\db\ActiveRecord
loadMultiple() Populates a set of models with the data from end user. yii\base\Model
makeRoot() Creates the root node if the active record is new or moves it as the root node. kartik\tree\models\Tree
markAttributeDirty() Marks an attribute dirty. yii\db\BaseActiveRecord
next() Gets the next sibling of the node. kartik\tree\models\Tree
off() Detaches an existing event handler from this component. yii\base\Component
offsetExists() yii\base\Model
offsetGet() yii\base\Model
offsetSet() yii\base\Model
offsetUnset() yii\base\Model
on() Attaches an event handler to an event. yii\base\Component
onUnsafeAttribute() This method is invoked when an unsafe attribute is being massively assigned. yii\base\Model
optimisticLock() Returns the name of the column that stores the lock version for implementing optimistic locking. yii\db\BaseActiveRecord
parents() Gets the parents of the node. kartik\tree\models\Tree
populateRecord() Populates an active record object using a row of data from the database/storage. yii\db\ActiveRecord
populateRelation() Populates the named relation with the related records. yii\db\BaseActiveRecord
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. kartik\tree\models\Tree
prev() Gets the previous sibling of the node. kartik\tree\models\Tree
primaryKey() Returns the primary key name(s) for this AR class. yii\db\ActiveRecord
refresh() Repopulates this active record with the latest data. yii\db\ActiveRecord
removeNode() Removes a node kartik\tree\models\TreeTrait
rules() Returns the validation rules for attributes. kartik\tree\models\TreeTrait
safeAttributes() Returns the attribute names that are safe to be massively assigned in the current scenario. yii\base\Model
save() Saves the current record. yii\db\BaseActiveRecord
scenarios() Returns a list of scenarios and the corresponding active attributes. yii\base\Model
setAttribute() Sets the named attribute value. yii\db\BaseActiveRecord
setAttributes() Sets the attribute values in a massive way. yii\base\Model
setIsNewRecord() Sets the value indicating whether the record is new. yii\db\BaseActiveRecord
setOldAttribute() Sets the old value of the named attribute. yii\db\BaseActiveRecord
setOldAttributes() Sets the old attribute values. yii\db\BaseActiveRecord
setScenario() Sets the scenario for the model. yii\base\Model
tableName() Declares the name of the database table associated with this AR class. kartik\tree\models\TreeTrait
toArray() Converts the model into an array. yii\base\ArrayableTrait
transactions() Declares which DB operations should be performed within a transaction in different scenarios. kartik\tree\models\TreeTrait
trigger() Triggers an event. yii\base\Component
unlink() Destroys the relationship between two models. yii\db\BaseActiveRecord
unlinkAll() Destroys the relationship in current model. yii\db\BaseActiveRecord
update() Saves the changes to this active record into the associated database table. yii\db\ActiveRecord
updateAll() Updates the whole table using the provided attribute values and conditions. yii\db\ActiveRecord
updateAllCounters() Updates the whole table using the provided counter changes and conditions. yii\db\ActiveRecord
updateAttributes() Updates the specified attributes. yii\db\BaseActiveRecord
updateCounters() Updates one or several counter columns for the current AR object. yii\db\BaseActiveRecord
validate() Performs the data validation. yii\base\Model
validateMultiple() Validates multiple models. yii\base\Model

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createRelationQuery() Creates a query instance for has-one or has-many relation. yii\db\BaseActiveRecord
deleteInternal() Deletes an ActiveRecord without considering transaction. yii\db\ActiveRecord
extractFieldsFor() Extract nested fields from a fields collection for a given root field Nested fields are separated with dots (.). e.g: "item.id" The previous example would extract "id". yii\base\ArrayableTrait
extractRootFields() Extracts the root field names from nested fields. yii\base\ArrayableTrait
filterCondition() Filters array condition before it is assiged to a Query filter. yii\db\ActiveRecord
filterValidAliases() Returns table aliases which are not the same as the name of the tables. yii\db\ActiveRecord
filterValidColumnNames() Valid column names are table column names or column names prefixed with table name or table alias yii\db\ActiveRecord
findByCondition() Finds ActiveRecord instance(s) by the given condition. yii\db\ActiveRecord
insertInternal() Inserts an ActiveRecord into DB without considering transaction. yii\db\ActiveRecord
parse() Parses an attribute value if set - else returns the default kartik\tree\models\TreeTrait
refreshInternal() Repopulates this active record with the latest data from a newly fetched instance. yii\db\BaseActiveRecord
resolveFields() Determines which fields can be returned by toArray(). yii\base\ArrayableTrait
setDefault() Sets default value of a model attribute kartik\tree\models\TreeTrait
updateInternal() yii\db\BaseActiveRecord

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_DELETE \yii\db\Event An event that is triggered after a record is deleted. yii\db\BaseActiveRecord
EVENT_AFTER_FIND \yii\db\Event An event that is triggered after the record is created and populated with query result. yii\db\BaseActiveRecord
EVENT_AFTER_INSERT yii\db\AfterSaveEvent An event that is triggered after a record is inserted. yii\db\BaseActiveRecord
EVENT_AFTER_REFRESH \yii\db\Event An event that is triggered after a record is refreshed. (available since version 2.0.8) yii\db\BaseActiveRecord
EVENT_AFTER_UPDATE yii\db\AfterSaveEvent An event that is triggered after a record is updated. yii\db\BaseActiveRecord
EVENT_AFTER_VALIDATE yii\base\Event An event raised at the end of validate() yii\base\Model
EVENT_BEFORE_DELETE yii\base\ModelEvent An event that is triggered before deleting a record. yii\db\BaseActiveRecord
EVENT_BEFORE_INSERT yii\base\ModelEvent An event that is triggered before inserting a record. yii\db\BaseActiveRecord
EVENT_BEFORE_UPDATE yii\base\ModelEvent An event that is triggered before updating a record. yii\db\BaseActiveRecord
EVENT_BEFORE_VALIDATE yii\base\ModelEvent An event raised at the beginning of validate(). yii\base\Model
EVENT_INIT \yii\db\Event An event that is triggered when the record is initialized via init(). yii\db\BaseActiveRecord

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
OP_ALL 7 All three operations: insert, update, delete. This is a shortcut of the expression: OP_INSERT | OP_UPDATE | OP_DELETE. yii\db\ActiveRecord
OP_DELETE 4 The delete operation. This is mainly used when overriding transactions() to specify which operations are transactional. yii\db\ActiveRecord
OP_INSERT 1 The insert operation. This is mainly used when overriding transactions() to specify which operations are transactional. yii\db\ActiveRecord
OP_UPDATE 2 The update operation. This is mainly used when overriding transactions() to specify which operations are transactional. yii\db\ActiveRecord
SCENARIO_DEFAULT 'default' The name of the default scenario. yii\base\Model

Property Details

$active public property

whether the node is active

public boolean $active null
$activeOrig public property

Attribute to cache the active state before a model update.

public boolean $activeOrig true
$collapsed public property

whether the node is collapsed

public boolean $collapsed null
$disabled public property

whether the node is disabled

public boolean $disabled null
$encodeNodeNames public property

Whether to HTML encode the tree node names.

public boolean $encodeNodeNames true
$icon public property

the icon to be displayed for the node

public string $icon null
$icon_type public property

the icon type (whether CSS or raw image)

public integer $icon_type null
$id public property

the node identifier

public integer|string $id null
$lft public property

the node nested set left value

public integer $lft null
$lvl public property

the node depth level

public integer $lvl null
$movable_d public property

whether the node is movable down (sibling)

public boolean $movable_d null
$movable_l public property

whether the node is movable one level up (parent) to the left

public boolean $movable_l null
$movable_r public property

whether the node is movable one level down (child) to the right

public boolean $movable_r null
$movable_u public property

whether the node is movable up (sibling)

public boolean $movable_u null
$name public property

the name for identifying the current node record

public string $name null
$nodeActivationErrors public property

Activation errors for the node.

$nodeRemovalErrors public property

Node removal errors.

$purifyNodeIcons public property

Whether to HTML purify the tree node icon content before saving.

public boolean $purifyNodeIcons true
$readonly public property

whether the node is readonly

public boolean $readonly null
$removable public property

whether the node is removable

public boolean $removable null
$removable_all public property

whether the node and all its children are removable

public boolean $removable_all null
$rgt public property

the node nested set right value

public integer $rgt null
$root public property

the node root identifier

public integer $root null
$selected public property

whether the node is selected

public boolean $selected null
$treeQueryClass public static property

The classname for the TreeQuery that implements the NestedSetQueryBehavior. If not set this will default to kartik\tree\models\TreeQuery.

public static string $treeQueryClass null
$visible public property

whether the node is visible

public boolean $visible null

Method Details

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.

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 ( kartik\tree\models\Tree $node, boolean $runValidation, array $attributes )
$node
$runValidation
$attributes
return boolean
children() public method

Gets the children of the node.

Gets the children of the node.

public kartik\tree\models\TreeQuery children ( integer $depth )
$depth
return kartik\tree\models\TreeQuery
delete() public method

Deletes the current node only. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason.

Deletes the current node only. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason.

public integer|boolean delete ( )
return integer|boolean
deleteWithChildren() public method

Deletes a node and its children. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason.

Deletes a node and its children. Returns the number of rows deleted or false if the deletion is unsuccessful for some reason.

public boolean deleteWithChildren ( )
return boolean
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.

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 ( kartik\tree\models\Tree $node, boolean $runValidation, array $attributes )
$node
$runValidation
$attributes
return boolean
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.

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 ( kartik\tree\models\Tree $node, boolean $runValidation, array $attributes )
$node
$runValidation
$attributes
return boolean
isChildOf() public method

Determines whether the node is child of the parent node.

Determines whether the node is child of the parent node.

public boolean isChildOf ( )
return boolean
isLeaf() public method

Determines whether the node is leaf.

Determines whether the node is leaf.

public boolean isLeaf ( )
return boolean
isRoot() public method

Determines whether the node is root.

Determines whether the node is root.

public boolean isRoot ( )
return boolean
leaves() public method

Gets the leaves of the node.

Gets the leaves of the node.

public kartik\tree\models\TreeQuery leaves ( )
return kartik\tree\models\TreeQuery
makeRoot() public method

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

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

public boolean makeRoot ( boolean $runValidation, array $attributes )
$runValidation
$attributes
return boolean
next() public method

Gets the next sibling of the node.

Gets the next sibling of the node.

public kartik\tree\models\TreeQuery next ( )
return kartik\tree\models\TreeQuery
parents() public method

Gets the parents of the node.

Gets the parents of the node.

public kartik\tree\models\TreeQuery parents ( integer $depth )
$depth
return kartik\tree\models\TreeQuery
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.

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 ( kartik\tree\models\Tree $node, boolean $runValidation, array $attributes )
$node
$runValidation
$attributes
return boolean
prev() public method

Gets the previous sibling of the node.

Gets the previous sibling of the node.

public kartik\tree\models\TreeQuery prev ( )
return kartik\tree\models\TreeQuery