protected function getMenuItemsFromTable(EntityInterface $menu): array
    {
        $query = $this->MenuItems->find('threaded', [
            'conditions' => ['MenuItems.menu_id' => $menu->id],
            'order' => ['MenuItems.lft']
        ]);

        if ($query->isEmpty()) {
            return [];
        }

        $result = [];
        $count = 0;
        foreach ($query->all() as $entity) {
            $item = $this->getMenuItem($menu, $entity->toArray(), ++$count);

            if (empty($item)) {
                continue;
            }
            $result[] = $item;
        }

        return $result;
    }
protected function getMenuItemsFromTable(EntityInterface $menu): array
    {
        $query = $this->MenuItems->find('threaded', [
            'conditions' => ['MenuItems.menu_id' => $menu->id],
            'order' => ['MenuItems.lft']
        ]);

        if ($query->isEmpty()) {
            return [];
        }

        $result = [];
        $count = 0;
        foreach ($query->all() as $entity) {
            $item = $this->getMenuItem($menu, $entity->toArray(), ++$count);

            if (empty($item)) {
                continue;
            }
            $result[] = $item;
        }

        return $result;
    }
protected function getMenuItemsFromTable ( EntityInterface $ menu ) : array { $ query = $ this -> MenuItems -> find ( 'threaded' , [ 'conditions' => [ 'MenuItems.menu_id' => $ menu -> id ] , 'order' => [ 'MenuItems.lft' ] ] ) ; if ( $ query -> isEmpty ( ) ) { return [ ] ; } $ result = [ ] ; $ count = 0 ; foreach ( $ query -> all ( ) as $ entity ) { $ item = $ this -> getMenuItem ( $ menu , $ entity -> toArray ( ) , ++ $ count ) ; if ( empty ( $ item ) ) { continue ; } $ result [ ] = $ item ; } return $ result ; }
Menu items getter using database table.

@param \Cake\Datasource\EntityInterface $menu Menu entity
@return mixed[]
Menu items getter using database table .