Files
kupshop/bundles/External/VarioBundle/Resources/script/RunVarioSynchronizationScript.php
2025-08-02 16:30:27 +02:00

35 lines
952 B
PHP

<?php
namespace External\VarioBundle\Resources\script;
use External\VarioBundle\Util\SynchronizerLocator;
use KupShop\AdminBundle\Util\Script\Script;
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
class RunVarioSynchronizationScript extends Script
{
protected static $name = '[Vario] Run synchronization';
protected static $defaultParameters = [
'type' => 'otProductSimple',
'forceSync' => null,
];
protected function run(array $arguments)
{
$locator = ServiceContainer::getService(SynchronizerLocator::class);
$this->log('Running...');
$synchronizer = $locator->getServiceByType($arguments['type']);
if (!empty($arguments['forceSync'])) {
$synchronizer->setForceSync($arguments['forceSync']);
}
$synchronizer->setDebug(true);
$synchronizer->sync();
$this->log('Done');
}
}
return RunVarioSynchronizationScript::class;