<?php

use FiloBlu\Refilo\Model\Upsell;
use FiloBlu\Refilo\Remote\Entity\Provider\RelatedProvider;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\State;

require __DIR__ . '/../../../../../app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get(State::class);
$state->setAreaCode('adminhtml');
$objectManager = ObjectManager::getInstance();

/** @var  RelatedProvider $attributeProvider */
//$provider = $objectManager->get(RelatedProvider::class);
//$result = iterator_to_array($provider);
/** @var ProductRepositoryInterface $productRepository */
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
/** @var Upsell $upsell */
$upsell = $objectManager->get(Upsell::class);

$ids = $upsell->setProduct($productRepository->get('MH01'))->getAllIds();


echo count($ids);

echo "Done\n";


// TO Change
// \Magento\TargetRule\Model\Rule::getPositionsLimit
// \Magento\TargetRule\Model\ResourceModel\Index::getOverfillLimit
