Feat: Adding Backfill Skus to the Migrate Import Job
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Modules\Core\Catalog\Services\SkuBackfillService;
|
||||
|
||||
class RunMigrateImportJob implements ShouldQueue
|
||||
{
|
||||
@@ -20,9 +21,19 @@ class RunMigrateImportJob implements ShouldQueue
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
public function handle(SkuBackfillService $skuBackfill): void
|
||||
{
|
||||
$importer = ImporterFactory::make($this->spec);
|
||||
$importer->import($this->spec);
|
||||
|
||||
// Only Shopify's importer creates ProductVariant rows at all (see
|
||||
// Shopify\ShopifyExportImporter) — JudgeMe never touches products,
|
||||
// so running this for that source would just be a guaranteed
|
||||
// no-op query every time. Source CSV rows genuinely can have no
|
||||
// `Variant SKU` value; see SkuBackfillService's own docblock for
|
||||
// why that's synthesized rather than treated as an importer bug.
|
||||
if ($this->spec->source === 'shopify') {
|
||||
$skuBackfill->backfill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user