<?php

use FiloBlu\Refilo\Remote\Entity\MagentoToRefiloProductAdapter;
use FiloBlu\Refilo\Remote\Entity\Product;
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);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get(State::class);
$state->setAreaCode('crontab');

// TEST FUNCTION
// \FiloBlu\Refilo\Remote\Entity\MagentoToRefiloProductAdapter::getConfigurableChildren2


/** @var ProductRepositoryInterface $productRepository */
$productRepository = $objectManager->get(ProductRepositoryInterface::class);
$product = $productRepository->get('MD01537E2', false, 1);

/** @var  MagentoToRefiloProductAdapter $adapter */
$adapter = $objectManager->create(MagentoToRefiloProductAdapter::class);

$productRefilo = new Product();

$result = $adapter->getConfigurableChildren($product, $productRefilo);

print_r($result);
