CodeExplorer buildDownloads example
$product['cover'
] =
['mediaId' => Random::
getRandomArrayElement($mediaIds)];
$product['media'
] =
array_map(fn (string
$id): array =>
['mediaId' =>
$id],
$this->faker->
randomElements($mediaIds,
random_int(2, 5
)));
} $product['properties'
] =
$this->
buildProperties($properties);
if ($i % 40 === 0
) { $combination =
$this->faker->
randomElement($combinations);
$product =
[...
$product, ...
$this->
buildVariants($combination,
$prices,
$taxes)];
} elseif ($i % 20 === 0
) { $product =
[...
$product, ...
$this->
buildDownloads($downloadMediaIds,
$instantDeliveryId)];
} $payload[] =
$product;
if (\
count($payload) >= 20
) { $this->io->
progressAdvance(\
count($payload));
$this->
write($payload,
$context);
$payload =
[];
} }