{"$schema":"https://yii2-framework.github.io/docs/reference/reference.schema.json","schemaVersion":1,"package":"nested-sets-behavior","title":"Nested sets behavior","repository":"https://github.com/yii2-extensions/nested-sets-behavior","ref":"main","commit":"e10a0ad055cc047adc402c25e71be2880a7397ac","generatedAt":"2026-10-30","url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/","types":{"yii2\\extensions\\nestedsets\\NestedSetsBehavior":{"kind":"class","url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/nestedsetsbehavior/","summary":"Manages hierarchical data in `yii\\db\\ActiveRecord` models using the nested sets pattern.","extends":"yii\\base\\Behavior","implements":["yii\\base\\Configurable"],"properties":{"depth":{"type":"int","virtual":true},"depthAttribute":{"type":"\"depth\"","default":"'depth'","description":"Attribute name."},"depthValue":{"type":"int|null","default":"null","description":"Cached depth of the owner, or `null` when it must be read from the owner attributes.","visibility":"protected"},"leftAttribute":{"type":"\"lft\"","default":"'lft'","description":"Attribute name."},"leftValue":{"type":"int|null","default":"null","description":"Cached left value of the owner, or `null` when it must be read from the owner attributes.","visibility":"protected"},"lft":{"type":"int","virtual":true},"lockTimeout":{"type":"int","default":"10","description":"Maximum wait in seconds for each guard-row acquisition; valid range is 1 through 3600."},"node":{"type":"yii\\db\\ActiveRecord<yii2\\extensions\\nestedsets\\T>|null","default":"null","description":"Target node of the pending operation, or `null` when the operation has no target.","visibility":"protected"},"operation":{"type":"string|null","default":"null","description":"Pending operation, one of the `OPERATION_*` constants, or `null` when no structural operation is pending.","visibility":"protected"},"rgt":{"type":"int","virtual":true},"rightAttribute":{"type":"\"rgt\"","default":"'rgt'","description":"Attribute name."},"rightValue":{"type":"int|null","default":"null","description":"Cached right value of the owner, or `null` when it must be read from the owner attributes.","visibility":"protected"},"treeAttribute":{"type":"string|false","default":"false","description":"Name of the attribute that stores the tree identifier, or `false` to keep a single tree per table."}},"methods":{"acquireTreeLock":{"signature":"public function acquireTreeLock(): void","summary":"Acquires the table writer lock before application reads or raw SQL in an existing Yii transaction.","return":{"type":"void"},"throws":[{"type":"Throwable","description":"if no Yii transaction is active, savepoints are disabled, `$lockTimeout` is out of range, the `nested_sets_lock` registry is missing, or the lock wait times out."}]},"afterDelete":{"signature":"public function afterDelete(): void","summary":"Closes the gap left by the deleted owner, moving the children of a node deleted on its own one level up.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if updating the remaining coordinates fails."}]},"afterInsert":{"signature":"public function afterInsert(): void","summary":"Assigns the primary key of a new root as its tree identifier when `$treeAttribute` is enabled.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if the owner model has no primary key or the tree identifier update fails."}]},"afterRefresh":{"signature":"public function afterRefresh(): void","summary":"Clears cached coordinates after a model refresh without cancelling an active operation.","return":{"type":"void"}},"afterUpdate":{"signature":"public function afterUpdate(): void","summary":"Moves the owner subtree to the position requested by the pending operation and reloads the owner coordinates.","return":{"type":"void"},"throws":[{"type":"RuntimeException","description":"if the pending operation does not move the owner relative to a target node."},{"type":"yii\\db\\StaleObjectException","description":"if the owner no longer exists when its coordinates are reloaded."}]},"appendTo":{"signature":"public function appendTo(yii2\\extensions\\nestedsets\\T $node, bool $runValidation = true, list<string>|null $attributes = null): bool","summary":"Appends the owner as the last child of the target node, inserting a new owner or moving an existing subtree.","params":[{"name":"$node","type":"yii2\\extensions\\nestedsets\\T","description":"Node that becomes the parent of the owner."},{"name":"$runValidation","type":"bool","default":"true","optional":true,"description":"Whether to validate the owner before saving."},{"name":"$attributes","type":"list<string>|null","default":"null","optional":true,"description":"Attributes to save, or `null` to save all attributes."}],"return":{"type":"bool","description":"Whether the owner was saved."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"beforeDelete":{"signature":"public function beforeDelete(): void","summary":"Acquires the table writer lock, reloads the owner coordinates, and rejects deleting a root node on its own.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if the owner is a new record."},{"type":"yii\\base\\NotSupportedException","description":"if the owner is a root and the deletion is not run by `deleteWithChildren()`."},{"type":"yii\\db\\StaleObjectException","description":"if the owner no longer exists or its optimistic lock version has changed."},{"type":"Throwable","description":"if the writer lock cannot be acquired, for example without an active Yii transaction."}]},"beforeInsert":{"signature":"public function beforeInsert(): void","summary":"Reloads the target coordinates and assigns the coordinates of the new owner according to the pending operation.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if the target node is a new record or uses another connection or table, if a sibling of a root is requested, or if a second root is created while `$treeAttribute` is `false`."},{"type":"yii\\base\\NotSupportedException","description":"if no supported operation is pending, for example on a plain `insert()`."},{"type":"yii\\db\\StaleObjectException","description":"if the target node no longer exists."}]},"beforeInsertNode":{"signature":"protected function beforeInsertNode(int $value, int $depth): void","summary":"Assigns the coordinates of a new child or sibling at the given position and opens space for it in the tree.","params":[{"name":"$value","type":"int","description":"Left value of the new node."},{"name":"$depth","type":"int","description":"Depth offset relative to the target node: `0` for a sibling, `1` for a child."}],"return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if a sibling of a root node is requested."}],"visibility":"protected"},"beforeInsertRootNode":{"signature":"protected function beforeInsertRootNode(): void","summary":"Assigns root coordinates to a new owner.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if `$treeAttribute` is `false` and the table already contains a node."}],"visibility":"protected"},"beforeUpdate":{"signature":"public function beforeUpdate(): void","summary":"Reloads the coordinates of the owner and the target and validates the pending move before the owner is updated.","return":{"type":"void"},"throws":[{"type":"yii\\db\\Exception","description":"if the move is invalid: promoting a root, making a root while `$treeAttribute` is `false`, or targeting a new record, the owner itself, one of its descendants, or a root for sibling moves."},{"type":"yii\\db\\StaleObjectException","description":"if the owner or the target no longer exists, or the owner optimistic lock version has changed."}]},"children":{"signature":"public function children(int|null $depth = null): yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","summary":"Returns a query for the descendants of the owner, ordered by left value and optionally limited in depth.","params":[{"name":"$depth","type":"int|null","default":"null","optional":true,"description":"Maximum number of levels below the owner, or `null` for all descendants."}],"return":{"type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query for the descendants of the owner."}},"deleteWithChildren":{"signature":"public function deleteWithChildren(): bool|int","summary":"Deletes the owner together with all its descendants.","return":{"type":"bool|int","description":"Number of deleted rows, or `false` if `yii\\db\\ActiveRecord::beforeDelete()` cancels the deletion."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"events":{"signature":"public function events(): string[]","summary":"Returns the `yii\\db\\ActiveRecord` lifecycle event handlers of the behavior.","return":{"type":"string[]","description":"The event handlers of the behavior."}},"insertAfter":{"signature":"public function insertAfter(yii\\db\\ActiveRecord $node, bool $runValidation = true, list<string>|null $attributes = null): bool","summary":"Places the owner as the next sibling of the target node, inserting a new owner or moving an existing subtree.","params":[{"name":"$node","type":"yii\\db\\ActiveRecord","description":"Node that becomes the previous sibling of the owner."},{"name":"$runValidation","type":"bool","default":"true","optional":true,"description":"Whether to validate the owner before saving."},{"name":"$attributes","type":"list<string>|null","default":"null","optional":true,"description":"Attributes to save, or `null` to save all attributes."}],"return":{"type":"bool","description":"Whether the owner was saved."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"insertBefore":{"signature":"public function insertBefore(yii\\db\\ActiveRecord $node, bool $runValidation = true, list<string>|null $attributes = null): bool","summary":"Places the owner as the previous sibling of the target node, inserting a new owner or moving an existing subtree.","params":[{"name":"$node","type":"yii\\db\\ActiveRecord","description":"Node that becomes the next sibling of the owner."},{"name":"$runValidation","type":"bool","default":"true","optional":true,"description":"Whether to validate the owner before saving."},{"name":"$attributes","type":"list<string>|null","default":"null","optional":true,"description":"Attributes to save, or `null` to save all attributes."}],"return":{"type":"bool","description":"Whether the owner was saved."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"invalidateCache":{"signature":"public function invalidateCache(): void","summary":"Clears the cached coordinates and discards the pending operation and target node.","return":{"type":"void"}},"isChildOf":{"signature":"public function isChildOf(yii\\db\\ActiveRecord $node): bool","summary":"Returns whether the owner is a descendant of the given node within the same tree.","params":[{"name":"$node","type":"yii\\db\\ActiveRecord","description":"Candidate ancestor of the owner."}],"return":{"type":"bool","description":"Whether the owner lies strictly inside the boundaries of the node and shares its tree identifier."}},"isLeaf":{"signature":"public function isLeaf(): bool","summary":"Returns whether the owner has no descendants.","return":{"type":"bool","description":"Whether the right value of the owner exceeds its left value by exactly `1`."}},"isRoot":{"signature":"public function isRoot(): bool","summary":"Returns whether the owner is a root node.","return":{"type":"bool","description":"Whether the left value of the owner is `1`."}},"leaves":{"signature":"public function leaves(): yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","summary":"Returns a query for the leaf descendants of the owner, ordered by left value.","return":{"type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query for the descendants of the owner that have no children."}},"makeRoot":{"signature":"public function makeRoot(bool $runValidation = true, list<string>|null $attributes = null): bool","summary":"Makes the owner a root, starting a new tree for a new owner or promoting an existing subtree to a new tree.","params":[{"name":"$runValidation","type":"bool","default":"true","optional":true,"description":"Whether to validate the owner before saving."},{"name":"$attributes","type":"list<string>|null","default":"null","optional":true,"description":"Attributes to save, or `null` to save all attributes."}],"return":{"type":"bool","description":"Whether the owner was saved."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"moveNode":{"signature":"protected function moveNode(yii2\\extensions\\nestedsets\\NodeContext $context): void","summary":"Moves the owner subtree to the position described by the context, within its tree or into another tree.","params":[{"name":"$context","type":"yii2\\extensions\\nestedsets\\NodeContext","description":"Target position and depth offset of the move."}],"return":{"type":"void"},"visibility":"protected"},"moveNodeAsRoot":{"signature":"protected function moveNodeAsRoot(mixed $treeValue): void","summary":"Promotes the owner subtree to a new tree identified by the owner primary key and closes the gap it leaves.","params":[{"name":"$treeValue","type":"mixed","description":"Identifier of the tree that currently contains the subtree."}],"return":{"type":"void"},"visibility":"protected"},"next":{"signature":"public function next(): yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","summary":"Returns a query for the next sibling of the owner.","return":{"type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query for the node whose left value follows the right value of the owner; empty when there is none."}},"parents":{"signature":"public function parents(int|null $depth = null): yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","summary":"Returns a query for the ancestors of the owner, ordered by left value and optionally limited in depth.","params":[{"name":"$depth","type":"int|null","default":"null","optional":true,"description":"Maximum number of levels above the owner, or `null` for all ancestors."}],"return":{"type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query for the ancestors of the owner."}},"prependTo":{"signature":"public function prependTo(yii\\db\\ActiveRecord $node, bool $runValidation = true, list<string>|null $attributes = null): bool","summary":"Prepends the owner as the first child of the target node, inserting a new owner or moving an existing subtree.","params":[{"name":"$node","type":"yii\\db\\ActiveRecord","description":"Node that becomes the parent of the owner."},{"name":"$runValidation","type":"bool","default":"true","optional":true,"description":"Whether to validate the owner before saving."},{"name":"$attributes","type":"list<string>|null","default":"null","optional":true,"description":"Attributes to save, or `null` to save all attributes."}],"return":{"type":"bool","description":"Whether the owner was saved."},"throws":[{"type":"Throwable","description":"if a lifecycle handler or database operation fails."}]},"prev":{"signature":"public function prev(): yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","summary":"Returns a query for the previous sibling of the owner.","return":{"type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query for the node whose right value precedes the left value of the owner; empty when there is none."}},"shiftLeftRightAttribute":{"signature":"protected function shiftLeftRightAttribute(int $value, int $delta): void","summary":"Adds the delta to every left and right value greater than or equal to the given value within the owner tree.","params":[{"name":"$value","type":"int","description":"Lowest boundary value to shift, inclusive."},{"name":"$delta","type":"int","description":"Signed offset to add; a negative value closes a gap."}],"return":{"type":"void"},"visibility":"protected"}},"constants":{"OPERATION_APPEND_TO":{"value":"'appendTo'","description":"Identifies the operation that places the owner as the last child of a target node."},"OPERATION_DELETE_WITH_CHILDREN":{"value":"'deleteWithChildren'","description":"Identifies the operation that deletes the owner together with all its descendants."},"OPERATION_INSERT_AFTER":{"value":"'insertAfter'","description":"Identifies the operation that places the owner as the next sibling of a target node."},"OPERATION_INSERT_BEFORE":{"value":"'insertBefore'","description":"Identifies the operation that places the owner as the previous sibling of a target node."},"OPERATION_MAKE_ROOT":{"value":"'makeRoot'","description":"Identifies the operation that creates the owner as a root or promotes it to the root of a new tree."},"OPERATION_PREPEND_TO":{"value":"'prependTo'","description":"Identifies the operation that places the owner as the first child of a target node."}},"inherited":{"properties":{"owner":"yii\\base\\Behavior"},"methods":{"__call":"yii\\base\\BaseObject","__construct":"yii\\base\\BaseObject","__get":"yii\\base\\BaseObject","__isset":"yii\\base\\BaseObject","__set":"yii\\base\\BaseObject","__unset":"yii\\base\\BaseObject","attach":"yii\\base\\Behavior","canGetProperty":"yii\\base\\BaseObject","canSetProperty":"yii\\base\\BaseObject","className":"yii\\base\\BaseObject","detach":"yii\\base\\Behavior","hasMethod":"yii\\base\\BaseObject","hasProperty":"yii\\base\\BaseObject","init":"yii\\base\\BaseObject"}}},"yii2\\extensions\\nestedsets\\NestedSetsQueryBehavior":{"kind":"class","url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/nestedsetsquerybehavior/","summary":"Adds root and leaf queries to an `yii\\db\\ActiveQuery` whose model is managed by `yii2\\extensions\\nestedsets\\NestedSetsBehavior`.","extends":"yii\\base\\Behavior","implements":["yii\\base\\Configurable"],"methods":{"leaves":{"signature":"public function leaves(): yii2\\extensions\\nestedsets\\T","summary":"Restricts the owner query to leaf nodes, ordered by tree identifier when enabled and then by left value.","return":{"type":"yii2\\extensions\\nestedsets\\T","description":"Owner query with the leaf condition and ordering applied."},"throws":[{"type":"LogicException","description":"if the behavior is not attached or the query model is not an `yii\\db\\ActiveRecord`."}]},"roots":{"signature":"public function roots(): yii2\\extensions\\nestedsets\\T","summary":"Restricts the owner query to root nodes, ordered by tree identifier when enabled and then by left value.","return":{"type":"yii2\\extensions\\nestedsets\\T","description":"Owner query with the root condition and ordering applied."},"throws":[{"type":"LogicException","description":"if the behavior is not attached or the query model is not an `yii\\db\\ActiveRecord`."}]}},"inherited":{"properties":{"owner":"yii\\base\\Behavior"},"methods":{"__call":"yii\\base\\BaseObject","__construct":"yii\\base\\BaseObject","__get":"yii\\base\\BaseObject","__isset":"yii\\base\\BaseObject","__set":"yii\\base\\BaseObject","__unset":"yii\\base\\BaseObject","attach":"yii\\base\\Behavior","canGetProperty":"yii\\base\\BaseObject","canSetProperty":"yii\\base\\BaseObject","className":"yii\\base\\BaseObject","detach":"yii\\base\\Behavior","events":"yii\\base\\Behavior","hasMethod":"yii\\base\\BaseObject","hasProperty":"yii\\base\\BaseObject","init":"yii\\base\\BaseObject"}}},"yii2\\extensions\\nestedsets\\NodeContext":{"kind":"class","modifiers":["final","readonly"],"url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/nodecontext/","summary":"Represents the immutable target position and depth offset of a node insertion or move relative to a target node.","properties":{"depthLevelDelta":{"type":"int","description":"Depth offset relative to the target node: `1` for a child, `0` for a sibling.","readonly":true,"promoted":true},"targetPositionValue":{"type":"int","description":"Left value the inserted or moved node takes.","readonly":true,"promoted":true}},"methods":{"__construct":{"signature":"public function __construct(yii\\db\\ActiveRecord $targetNode, int $targetPositionValue, int $depthLevelDelta)","summary":"Creates a context for a position relative to the target node.","params":[{"name":"$targetNode","type":"yii\\db\\ActiveRecord","description":"Node the insertion or move is relative to."},{"name":"$targetPositionValue","type":"int","description":"Left value the inserted or moved node takes."},{"name":"$depthLevelDelta","type":"int","description":"Depth offset relative to the target node: `1` for a child, `0` for a sibling."}]},"forAppendTo":{"signature":"public static function forAppendTo(yii\\db\\ActiveRecord $targetNode, \"rgt\" $rightAttribute): self","summary":"Creates the context that places a node as the last child of the target node.","params":[{"name":"$targetNode","type":"yii\\db\\ActiveRecord","description":"Node that becomes the parent."},{"name":"$rightAttribute","type":"\"rgt\"","description":"Name of the right boundary attribute."}],"return":{"type":"self","description":"Context positioned at the target right value."},"static":true},"forInsertAfter":{"signature":"public static function forInsertAfter(yii\\db\\ActiveRecord $targetNode, \"rgt\" $rightAttribute): self","summary":"Creates the context that places a node as the next sibling of the target node.","params":[{"name":"$targetNode","type":"yii\\db\\ActiveRecord","description":"Node that becomes the previous sibling."},{"name":"$rightAttribute","type":"\"rgt\"","description":"Name of the right boundary attribute."}],"return":{"type":"self","description":"Context positioned right after the target right value."},"static":true},"forInsertBefore":{"signature":"public static function forInsertBefore(yii\\db\\ActiveRecord $targetNode, \"lft\" $leftAttribute): self","summary":"Creates the context that places a node as the previous sibling of the target node.","params":[{"name":"$targetNode","type":"yii\\db\\ActiveRecord","description":"Node that becomes the next sibling."},{"name":"$leftAttribute","type":"\"lft\"","description":"Name of the left boundary attribute."}],"return":{"type":"self","description":"Context positioned at the target left value."},"static":true},"forPrependTo":{"signature":"public static function forPrependTo(yii\\db\\ActiveRecord $targetNode, \"lft\" $leftAttribute): self","summary":"Creates the context that places a node as the first child of the target node.","params":[{"name":"$targetNode","type":"yii\\db\\ActiveRecord","description":"Node that becomes the parent."},{"name":"$leftAttribute","type":"\"lft\"","description":"Name of the left boundary attribute."}],"return":{"type":"self","description":"Context positioned right after the target left value."},"static":true},"getTargetDepth":{"signature":"public function getTargetDepth(\"depth\" $depthAttribute): int","summary":"Returns the depth of the target node.","params":[{"name":"$depthAttribute","type":"\"depth\"","description":"Name of the depth attribute."}],"return":{"type":"int","description":"Depth of the target node.e"}},"getTargetTreeValue":{"signature":"public function getTargetTreeValue(false|string $treeAttribute): mixed","summary":"Returns the tree identifier of the target node.","params":[{"name":"$treeAttribute","type":"false|string","description":"Name of the tree attribute, or `false` when multiple trees are disabled."}],"return":{"type":"mixed","description":"Tree identifier, or `null` when `$treeAttribute` is `false`."}}}},"yii2\\extensions\\nestedsets\\QueryConditionBuilder":{"kind":"class","modifiers":["final"],"url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/queryconditionbuilder/","summary":"Builds Yii condition arrays and offset expressions for nested set queries and bulk coordinate updates.","methods":{"createChildrenCondition":{"signature":"public static function createChildrenCondition(string $leftAttribute, int $leftValue, string $rightAttribute, int $rightValue, false|string $treeAttribute = false, mixed $treeValue = null, string|null $depthAttribute = null, int|null $parentDepth = null, int|null $maxRelativeDepth = null): array<int|string, mixed>","summary":"Returns a condition matching the descendants of a node, optionally limited to a maximum depth below it.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$leftValue","type":"int","description":"Left value of the ancestor."},{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$rightValue","type":"int","description":"Right value of the ancestor."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."},{"name":"$depthAttribute","type":"string|null","default":"null","optional":true,"description":"Name of the depth attribute, or `null` to skip depth filtering."},{"name":"$parentDepth","type":"int|null","default":"null","optional":true,"description":"Depth of the ancestor; required together with `$maxRelativeDepth`."},{"name":"$maxRelativeDepth","type":"int|null","default":"null","optional":true,"description":"Maximum number of levels below the ancestor, or `null` for all descendants."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the descendants."},"static":true},"createCrossTreeMoveCondition":{"signature":"public static function createCrossTreeMoveCondition(string $attribute, int $value, string $treeAttribute, mixed $treeValue): array<int|string, mixed>","summary":"Returns a condition matching the nodes of a tree whose boundary value is at least the given value.","params":[{"name":"$attribute","type":"string","description":"Name of the left or right boundary attribute to compare."},{"name":"$value","type":"int","description":"Lowest boundary value to match, inclusive."},{"name":"$treeAttribute","type":"string","description":"Name of the tree attribute."},{"name":"$treeValue","type":"mixed","description":"Identifier of the tree that receives the subtree."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the nodes to shift."},"static":true},"createLeavesCondition":{"signature":"public static function createLeavesCondition(string $leftAttribute, string $rightAttribute, false|string $treeAttribute = false, mixed $treeValue = null, int|null $parentLeftValue = null, int|null $parentRightValue = null): array<int|string, mixed>","summary":"Returns a condition matching the leaf nodes strictly inside the given ancestor boundaries.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."},{"name":"$parentLeftValue","type":"int|null","default":"null","optional":true,"description":"Left value of the ancestor whose leaves are matched."},{"name":"$parentRightValue","type":"int|null","default":"null","optional":true,"description":"Right value of the ancestor whose leaves are matched."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the leaf descendants."},"static":true},"createNextSiblingCondition":{"signature":"public static function createNextSiblingCondition(string $leftAttribute, int $rightValue, false|string $treeAttribute = false, mixed $treeValue = null): array<int|string, mixed>","summary":"Returns a condition matching the node whose left value immediately follows the given right value.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$rightValue","type":"int","description":"Right value of the reference node."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the next sibling."},"static":true},"createOffsetUpdates":{"signature":"public static function createOffsetUpdates(yii\\db\\Connection $db, array<string, int> $attributeOffsets): array<string, yii\\db\\Expression>","summary":"Returns column expressions for `updateAll()` that add a signed offset to each given attribute.","params":[{"name":"$db","type":"yii\\db\\Connection","description":"Connection used to quote the column names."},{"name":"$attributeOffsets","type":"array<string, int>","description":"Signed offsets indexed by attribute name."}],"return":{"type":"array<string, yii\\db\\Expression>","description":"Offset expressions indexed by attribute name."},"static":true},"createParentsCondition":{"signature":"public static function createParentsCondition(string $leftAttribute, int $leftValue, string $rightAttribute, int $rightValue, false|string $treeAttribute = false, mixed $treeValue = null, string|null $depthAttribute = null, int|null $childDepth = null, int|null $maxRelativeDepth = null): array<int|string, mixed>","summary":"Returns a condition matching the ancestors of a node, optionally limited to a maximum number of levels above it.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$leftValue","type":"int","description":"Left value of the node."},{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$rightValue","type":"int","description":"Right value of the node."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."},{"name":"$depthAttribute","type":"string|null","default":"null","optional":true,"description":"Name of the depth attribute, or `null` to skip depth filtering."},{"name":"$childDepth","type":"int|null","default":"null","optional":true,"description":"Depth of the node; required together with `$maxRelativeDepth`."},{"name":"$maxRelativeDepth","type":"int|null","default":"null","optional":true,"description":"Maximum number of levels above the node, or `null` for all ancestors."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the ancestors."},"static":true},"createPrevSiblingCondition":{"signature":"public static function createPrevSiblingCondition(string $rightAttribute, int $leftValue, false|string $treeAttribute = false, mixed $treeValue = null): array<int|string, mixed>","summary":"Returns a condition matching the node whose right value immediately precedes the given left value.","params":[{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$leftValue","type":"int","description":"Left value of the reference node."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the previous sibling."},"static":true},"createRangeCondition":{"signature":"public static function createRangeCondition(string $leftAttribute, int $leftValue, string $rightAttribute, int $rightValue, false|string $treeAttribute = false, mixed $treeValue = null): array<int|string, mixed>","summary":"Returns a condition matching the nodes whose boundaries lie within the given range, inclusive.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$leftValue","type":"int","description":"Lowest left value to match."},{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$rightValue","type":"int","description":"Highest right value to match."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the subtree, including its root."},"static":true},"createShiftCondition":{"signature":"public static function createShiftCondition(string $attribute, int $value, false|string $treeAttribute = false, mixed $treeValue = null): array<int|string, mixed>","summary":"Returns a condition matching the nodes whose boundary value is at least the given value.","params":[{"name":"$attribute","type":"string","description":"Name of the left or right boundary attribute to compare."},{"name":"$value","type":"int","description":"Lowest boundary value to match, inclusive."},{"name":"$treeAttribute","type":"false|string","default":"false","optional":true,"description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$treeValue","type":"mixed","default":"null","optional":true,"description":"Tree identifier to match; ignored when `$treeAttribute` is `false`."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the nodes to shift."},"static":true},"createSubtreeMoveCondition":{"signature":"public static function createSubtreeMoveCondition(string $leftAttribute, int $leftValue, string $rightAttribute, int $rightValue, false|string $treeAttribute, mixed $currentTreeValue): array<int|string, mixed>","summary":"Returns a condition matching a subtree, including its root, within its current tree.","params":[{"name":"$leftAttribute","type":"string","description":"Name of the left boundary attribute."},{"name":"$leftValue","type":"int","description":"Left value of the subtree root."},{"name":"$rightAttribute","type":"string","description":"Name of the right boundary attribute."},{"name":"$rightValue","type":"int","description":"Right value of the subtree root."},{"name":"$treeAttribute","type":"false|string","description":"Name of the tree attribute, or `false` when multiple trees are disabled."},{"name":"$currentTreeValue","type":"mixed","description":"Identifier of the tree that currently contains the subtree."}],"return":{"type":"array<int|string, mixed>","description":"Condition matching the subtree to move."},"static":true}}},"yii2\\extensions\\nestedsets\\TreeLock":{"kind":"class","modifiers":["final"],"url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/treelock/","summary":"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.","methods":{"acquire":{"signature":"public static function acquire(yii\\db\\ActiveRecord $owner, int $timeout): void","summary":"Acquires the writer lock of the owner's physical table for the remainder of the active outermost transaction.","params":[{"name":"$owner","type":"yii\\db\\ActiveRecord","description":"Record whose physical table is locked."},{"name":"$timeout","type":"int","description":"Maximum wait in seconds for the registry row lock."}],"return":{"type":"void"},"throws":[{"type":"yii\\base\\InvalidConfigException","description":"if `$timeout` is outside `1` through `3600`, if no Yii transaction is active on the owner connection, if the table is not a physical base table visible in the catalog, if the lock migration is not applied (missing bootstrap row, or non-InnoDB tables on MySQL), or if the registry row cannot be registered."},{"type":"yii\\base\\NotSupportedException","description":"if `yii\\db\\Connection::$enableSavepoint` is `false`, if the driver is not supported, or if a SQLite table is outside the `main` database."},{"type":"Throwable","description":"if the lock wait times out or another database error occurs; the savepoint is rolled back."}],"static":true},"exists":{"signature":"public static function exists(yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T> $query): bool","summary":"Returns whether the query matches any row, reading with the same current-read semantics as coordinate reloads.","params":[{"name":"$query","type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query to test; it is cloned and its ordering is dropped."}],"return":{"type":"bool","description":"Whether any row matches the query."},"static":true},"one":{"signature":"public static function one(yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T> $query): yii2\\extensions\\nestedsets\\T|null","summary":"Returns the first matching record, reading current MySQL coordinates even under an older repeatable-read view.","params":[{"name":"$query","type":"yii\\db\\ActiveQuery<yii2\\extensions\\nestedsets\\T>","description":"Query that selects the record."}],"return":{"type":"yii2\\extensions\\nestedsets\\T|null","description":"Matching record, or `null` if no row matches."},"static":true},"rollBack":{"signature":"public static function rollBack(yii\\db\\Connection $db, yii\\db\\Transaction $transaction, Throwable $cause): void","summary":"Rolls back the failed scope and clears Yii levels when the server aborted the whole transaction.","params":[{"name":"$db","type":"yii\\db\\Connection","description":"Connection that owns the transaction."},{"name":"$transaction","type":"yii\\db\\Transaction","description":"Transaction scope to roll back."},{"name":"$cause","type":"Throwable","description":"Failure that triggered the rollback; used to detect SQL Server deadlocks."}],"return":{"type":"void"},"throws":[{"type":"Throwable","description":"if the rollback fails for a reason other than SQLite having already discarded the transaction."}],"static":true}},"constants":{"BOOTSTRAP":{"value":"'_bootstrap'","description":"Registry key of the row that serializes the registration of missing table keys."},"TABLE_NAME":{"value":"'nested_sets_lock'","description":"Name of the lock registry table, created by the lock migration in the schema of each nested set table."}}},"yii2\\extensions\\nestedsets\\exception\\Message":{"kind":"enum","url":"https://yii2-framework.github.io/docs/extensions/nested-sets-behavior/reference/exception/message/","summary":"Defines nested sets exception message templates.","backingType":"string","cases":{"BEHAVIOR_NOT_ATTACHED":{"value":"'The \"owner\" property must be set before using the behavior.'","description":"Error when the behavior is used without an attached owner."},"CANNOT_CREATE_MULTIPLE_ROOTS":{"value":"\"Can not create more than one root when 'treeAttribute' is 'false'.\"","description":"Error when a second root is created while `treeAttribute` is `false`."},"CANNOT_CREATE_NODE_TARGET_IS_NEW_RECORD":{"value":"'Can not create a node when the target node is new record.'","description":"Error when a node is created relative to a new record target."},"CANNOT_CREATE_NODE_TARGET_IS_ROOT":{"value":"'Can not create a node when the target node is root.'","description":"Error when a sibling of a root node is created."},"CANNOT_DELETE_NEW_RECORD":{"value":"'Can not delete a node when it is new record.'","description":"Error when a new record is deleted as a node."},"CANNOT_MOVE_NODE_AS_ROOT":{"value":"\"Can not move a node as the root when 'treeAttribute' is 'false'.\"","description":"Error when a node is moved as a root while `treeAttribute` is `false`."},"CANNOT_MOVE_NODE_TARGET_IS_CHILD":{"value":"'Can not move a node when the target node is child.'","description":"Error when a node is moved relative to one of its descendants."},"CANNOT_MOVE_NODE_TARGET_IS_NEW_RECORD":{"value":"'Can not move a node when the target node is new record.'","description":"Error when a node is moved relative to a new record target."},"CANNOT_MOVE_NODE_TARGET_IS_ROOT":{"value":"'Can not move a node when the target node is root.'","description":"Error when a node is moved as a sibling of a root node."},"CANNOT_MOVE_NODE_TARGET_IS_SAME":{"value":"'Can not move a node when the target node is same.'","description":"Error when a node is moved relative to itself."},"CANNOT_MOVE_ROOT_AS_ROOT":{"value":"'Can not move the root node as the root.'","description":"Error when a root node is moved as a root."},"CANNOT_READ_SQLITE_BUSY_TIMEOUT":{"value":"'Cannot read SQLite busy timeout.'","description":"Error when the SQLite busy timeout cannot be read."},"CANNOT_READ_SQLSRV_LOCK_TIMEOUT":{"value":"'Cannot read SQL Server lock timeout.'","description":"Error when the SQL Server lock timeout cannot be read."},"CANNOT_REGISTER_WRITER_ROW":{"value":"'Cannot register the nested set writer row.'","description":"Error when the writer registry row cannot be registered."},"CANNOT_RESOLVE_MYSQL_IDENTIFIER_CASE":{"value":"'Cannot resolve MySQL identifier case rules.'","description":"Error when the MySQL identifier case mode cannot be resolved."},"CANNOT_RESOLVE_SQLSRV_DATABASE":{"value":"'Cannot resolve the SQL Server database.'","description":"Error when the SQL Server database cannot be resolved."},"DELETE_ROOT_NOT_SUPPORTED":{"value":"\"Method '%s::delete' is not supported for deleting root nodes.\"","description":"Error when a root node is deleted outside `deleteWithChildren()` for a specific class."},"INSERT_NOT_SUPPORTED":{"value":"\"Method '%s::insert' is not supported for inserting new nodes.\"","description":"Error when a node is inserted without a pending operation for a specific class."},"INVALID_TABLE_METADATA":{"value":"'Invalid nested set table metadata.'","description":"Error when the catalog row holds non-scalar table metadata."},"LOCK_BOOTSTRAP_ROW_MISSING":{"value":"\"Missing nested set bootstrap row. Apply 'm261016_000001_nested_sets_lock' in the \" . 'model table schema.'","description":"Error when the writer lock bootstrap row is missing."},"LOCK_DRIVER_NOT_SUPPORTED":{"value":"'Nested set writer locking is not implemented for this database driver.'","description":"Error when writer locking is not implemented for the database driver."},"LOCK_REQUIRES_INNODB":{"value":"'Nested set and nested_sets_lock tables must use InnoDB; apply the lock migration ' . 'first.'","description":"Error when a MySQL nested set or registry table does not use InnoDB."},"LOCK_REQUIRES_PHYSICAL_TABLE":{"value":"'Nested set locking requires a physical base table visible in the database ' . 'catalog.'","description":"Error when the nested set table is not a physical base table visible in the catalog."},"LOCK_REQUIRES_SAVEPOINTS":{"value":"'Nested set writer locking requires savepoint support; enable ' . '\\'Connection::$enableSavepoint\\'.'","description":"Error when savepoints are disabled on the connection."},"LOCK_REQUIRES_SQLITE_MAIN_DATABASE":{"value":"'Nested set locking supports the SQLite main database only.'","description":"Error when a SQLite table is outside the `main` database."},"LOCK_TIMEOUT_OUT_OF_RANGE":{"value":"\"Nested set lockTimeout must be between '1' and '3600' seconds.\"","description":"Error when the lock timeout is outside the accepted range."},"MODEL_NOT_ACTIVE_RECORD":{"value":"'Nested set queries require an ActiveRecord model.'","description":"Error when a nested set query model is not an ActiveRecord class."},"NODE_MODIFIED":{"value":"'The nested set node has been modified by another request.'","description":"Error when a node optimistic lock version has changed."},"NODE_NOT_FOUND":{"value":"'The nested set node no longer exists.'","description":"Error when a node no longer exists in storage."},"PHYSICAL_TABLE_IDENTITY_MISSING":{"value":"'Missing physical table identity.'","description":"Error when the catalog row lacks the physical table identity."},"PRIMARY_KEY_REQUIRED":{"value":"\"'%s' must have a primary key.\"","description":"Error when the owner model has no primary key for a specific class."},"TABLE_NOT_FOUND":{"value":"'The nested set table does not exist.'","description":"Error when the nested set table does not exist."},"TARGET_STORAGE_MISMATCH":{"value":"'The target node must use the same database connection and table.'","description":"Error when the target node uses another database connection or table."},"TRANSACTION_REQUIRED":{"value":"\"Nested set writes require a Yii database transaction. Configure 'transactions()' or \" . 'begin an outer transaction.'","description":"Error when a write runs without an active Yii database transaction."},"TREE_ATTRIBUTE_REQUIRED":{"value":"\"Moving a subtree between trees requires 'treeAttribute'.\"","description":"Error when a subtree is moved between trees while `treeAttribute` is `false`."},"UNSUPPORTED_OPERATION":{"value":"\"Unsupported operation: '%s'\"","description":"Error when the pending operation does not move a node relative to a target."}},"methods":{"getMessage":{"signature":"public function getMessage(int|string ...$argument): string","summary":"Returns the formatted message string for the error case.","params":[{"name":"$argument","type":"int|string","optional":true,"variadic":true,"description":"Values to insert into the message template."}],"return":{"type":"string","description":"Formatted error message with interpolated arguments."}}}}}}
