TreeCollection

Custom collection used by NestedTree trait.

 class Winter\Storm\Database\TreeCollection
extends Winter\Storm\Database\Collection

General access methods:

$collection->toNested(); // Converts collection to an eager loaded one.

Methods

public listsNested (string $value, string $key = null, string $indent = "   ") : array

Gets an array with values of a given column. Values are indented according to their depth.

Parameters
Property Description
$value
string

Array values

$key
string

Array keys

$indent
string

Character to indent depth

Returns
array

public toNested (boolean $removeOrphans = true) : Winter\Storm\Database\Collection

Converts a flat collection of nested set models to an set where children is eager loaded

Parameters
Property Description
$removeOrphans
boolean

Remove nodes that exist without their parents.

Returns

public lists (string $value, string $key = null) : array

Inherited from Collection

Get an array with the values of a given key.

Parameters
Property Description
$value
string
$key
string
Returns
array
Copyright © 2024 Winter CMS