How to get sub items of parent menu item?

As a workaround I have this temporary solution:

$the_menu       = wp_get_nav_menu_object('Some Menu');
$the_menu_items = wp_get_nav_menu_items($the_menu);

$category_products = [];

foreach ($the_menu_items as $index => $menu_category) {
    if ($menu_category->object_id == $category->term_id ) {
        $category_submenu = $menu_category;
    }
}

foreach ($the_menu_items as $index => $menu_product) {
    if ($menu_product->type_label == 'Product'
         && $menu_product->menu_item_parent == $category_submenu->ID
    ) {
        $category_products[] = $menu_product;
    }
}

I’m parsing all menu items (both parent items and sub items), getting the necessary item based on current category ID and then retrieving the sub items (products) of each category by parsing all the items one more time and checking if current item (product) parent ID matches with the parent category item ID and I just put it into an array.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)