47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\LingxingErp\Setup\Patch\Data;
|
|
|
|
use Esun\LingxingErp\Model\Api\Endpoint;
|
|
use Magento\Framework\Setup\ModuleDataSetupInterface;
|
|
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
|
|
|
class BackfillLogApiPath implements DataPatchInterface
|
|
{
|
|
public function __construct(private readonly ModuleDataSetupInterface $moduleDataSetup)
|
|
{
|
|
}
|
|
|
|
public function apply(): self
|
|
{
|
|
$connection = $this->moduleDataSetup->getConnection();
|
|
$table = $this->moduleDataSetup->getTable('esun_lingxing_sync_log');
|
|
$connection->startSetup();
|
|
foreach ([
|
|
'store_sync' => Endpoint::STORE_LIST,
|
|
'order_create' => Endpoint::ORDER_CREATE,
|
|
'sku_pair_lookup' => Endpoint::PAIR_LIST,
|
|
'shipment_pull' => Endpoint::WMS_ORDER_LIST,
|
|
] as $operation => $apiPath) {
|
|
$connection->update(
|
|
$table,
|
|
['api_path' => $apiPath],
|
|
['operation = ?' => $operation, 'api_path IS NULL']
|
|
);
|
|
}
|
|
$connection->endSetup();
|
|
return $this;
|
|
}
|
|
|
|
public static function getDependencies(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function getAliases(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|