src/Model/Table/DblistItemsTable.php
public function findTreeEntities(QueryInterface $query, array $options) : QueryInterface
    {
        $query = $query->where(['dblist_id' => $options['listId']])
            ->order(['lft' => 'asc']);

        // workaround for getting spacer.
        $tree = $this->find('treeList', ['spacer' => '&nbsp;&nbsp;&nbsp;&nbsp;'])
                ->toArray();

        foreach ($query->all() as $item) {
            $id = $item->get('id');
            if (in_array($id, array_keys($tree))) {
                $item->set('spacer', $tree[$id]);
            }
        }

        return $query;
    }
public function findTreeEntities(QueryInterface $query, array $options) : QueryInterface
    {
        $query = $query->where(['dblist_id' => $options['listId']])
            ->order(['lft' => 'asc']);

        // workaround for getting spacer.
        $tree = $this->find('treeList', ['spacer' => '&nbsp;&nbsp;&nbsp;&nbsp;'])
                ->toArray();

        foreach ($query->all() as $item) {
            $id = $item->get('id');
            if (in_array($id, array_keys($tree))) {
                $item->set('spacer', $tree[$id]);
            }
        }

        return $query;
    }
public function findTreeEntities ( QueryInterface $ query , array $ options ) : QueryInterface { $ query = $ query -> where ( [ 'dblist_id' => $ options [ 'listId' ] ] ) -> order ( [ 'lft' => 'asc' ] ) ; // workaround for getting spacer. $ tree = $ this -> find ( 'treeList' , [ 'spacer' => '&nbsp;&nbsp;&nbsp;&nbsp;' ] ) -> toArray ( ) ; foreach ( $ query -> all ( ) as $ item ) { $ id = $ item -> get ( 'id' ) ; if ( in_array ( $ id , array_keys ( $ tree ) ) ) { $ item -> set ( 'spacer' , $ tree [ $ id ] ) ; } } return $ query ; }
Return all the entities along with the spacer from the treeList.

Options should be
- listId: List Id to fetch its items.

@see  \Cake\ORM\Behavior\TreeBehavior::findTreeList
@param \Cake\Datasource\QueryInterface $query The query
@param mixed[] $options Query options
@return \Cake\Datasource\QueryInterface
Return all the entities along with the spacer from the treeList .