TreeConfig
in package
FinalYes
Configuration of a nested-set tree for move operations (`TreeTrait` across the model layers). Holds the property names of the tree bounds and an optional scope filter that tells apart separate trees in one table.
Scope is a property path => value; it is always added to the WHERE of all move SQL queries,
so the operation touches only the chosen tree (e.g. ['menuId' => 5] for the items of one
menu). An empty scope means the table has a single tree (pages).
Not a DI service (scalar constructor): built by hand and serialized through toArray() / fromArray() when passed over ApiBridge.
Table of Contents
Properties
- $leftProperty : string
- $levelProperty : string
- $parentProperty : string
- $rightProperty : string
- $scope : array<string|int, mixed>
Methods
- __construct() : mixed
- fromArray() : self
-
toArray()
: array{left: string, right: string, parent: string, level: string, scope: array
}
Properties
$leftProperty read-only
public
string
$leftProperty
= 'lft'
$levelProperty read-only
public
string
$levelProperty
= 'level'
$parentProperty read-only
public
string
$parentProperty
= 'parentId'
$rightProperty read-only
public
string
$rightProperty
= 'rgt'
$scope read-only
public
array<string|int, mixed>
$scope
= []
Methods
__construct()
public
__construct([string $leftProperty = 'lft' ][, string $rightProperty = 'rgt' ][, string $parentProperty = 'parentId' ][, string $levelProperty = 'level' ][, array<string, scalar|null> $scope = [] ]) : mixed
Parameters
- $leftProperty : string = 'lft'
-
property of the left bound (lft)
- $rightProperty : string = 'rgt'
-
property of the right bound (rgt)
- $parentProperty : string = 'parentId'
-
property of the parent (parentId)
- $levelProperty : string = 'level'
- $scope : array<string, scalar|null> = []
-
property => value (scope filter of the tree)
fromArray()
public
static fromArray(array<string, mixed> $data) : self
Parameters
- $data : array<string, mixed>
Return values
selftoArray()
public
toArray() : array{left: string, right: string, parent: string, level: string, scope: array}