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.
Extends
Class | Description |
---|---|
Collection
|
Proxy class. |
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 | Type | Description |
---|---|---|
$value | string |
string
Array values |
$key | string |
string
Array keys |
$indent | string |
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 | Type | Description |
---|---|---|
$removeOrphans | boolean |
boolean
Remove nodes that exist without their parents. |
Returns
inherited
public
lists (string $value, string $key = null
)
: array
Inherited from
Collection
Get an array with the values of a given key.
Parameters
Property | Type | Description |
---|---|---|
$value | string |
string
|
$key | string |
string
|
Returns
array
Copyright © 2024 Winter CMS