phpcakephpcakephp-4.x

Tree list with all database columns


I'm looking at the Tree Behavior in CakePHP 4.

How does one get all database columns when getting a representation of the tree using treeList? Example:

$treeList = $this->Tasks->find('treeList')

At this time, all I can think of is looping the list, fetching individual records and pushing to an array?

$tasks = [];

foreach($treeList as $key => $value)
{
    array_push($tasks, $this->Tasks->get($key));
}

Solution

  • I ended up using the threaded option in find:

    find('threaded')