# Nested sets behavior API reference

> API reference of the Nested sets behavior extension (yii2\extensions\nestedsets), generated from its PHPDoc.

[API reference](/docs/api/index.md) › Nested sets behavior

Classes, interfaces, traits and enums of `yii2\extensions\nestedsets`, generated from the PHPDoc of [yii2-extensions/nested-sets-behavior](https://github.com/yii2-extensions/nested-sets-behavior) at `main`. Machine-readable catalog: [nested-sets-behavior.json](https://yii2-framework.github.io/docs/reference/nested-sets-behavior.json).

## Namespaces

| Namespace | Types |
| --- | --- |
| [`yii2\extensions\nestedsets\exception`](/docs/extensions/nested-sets-behavior/reference/exception/index.md) | 1 |

## Classes

| Class | Summary |
| --- | --- |
| [`NestedSetsBehavior`](/docs/extensions/nested-sets-behavior/reference/nestedsetsbehavior/index.md) | Manages hierarchical data in [`ActiveRecord`](/docs/api/yii/db/activerecord/index.md) models using the nested sets pattern. |
| [`NestedSetsQueryBehavior`](/docs/extensions/nested-sets-behavior/reference/nestedsetsquerybehavior/index.md) | Adds root and leaf queries to an [`ActiveQuery`](/docs/api/yii/db/activequery/index.md) whose model is managed by [`NestedSetsBehavior`](/docs/extensions/nested-sets-behavior/reference/nestedsetsbehavior/index.md). |
| [`NodeContext`](/docs/extensions/nested-sets-behavior/reference/nodecontext/index.md) final readonly | Represents the immutable target position and depth offset of a node insertion or move relative to a target node. |
| [`QueryConditionBuilder`](/docs/extensions/nested-sets-behavior/reference/queryconditionbuilder/index.md) final | Builds Yii condition arrays and offset expressions for nested set queries and bulk coordinate updates. |
| [`TreeLock`](/docs/extensions/nested-sets-behavior/reference/treelock/index.md) final | Serializes the writers of one physical table through a row of the `nested_sets_lock` registry, held until the outermost transaction commits or rolls back. |