CodeExplorer createSimpleProduct example
$combinations[] =
$this->
buildCombinations($properties);
} $max =
max(min($count / 3, 200
), 5
);
$prices =
[];
for ($i = 0;
$i <=
$max; ++
$i) { $prices[] =
$this->
createPrices($ruleIds);
} $payload =
[];
for ($i = 0;
$i <
$count; ++
$i) { $product =
$this->
createSimpleProduct($taxes,
$manufacturers,
$tags);
$product['prices'
] =
$this->faker->
randomElement($prices);
$product['visibilities'
] =
$visibilities;
if ($mediaIds) { $product['cover'
] =
['mediaId' => Random::
getRandomArrayElement($mediaIds)];
$product['media'
] =
array_map(fn (string
$id): array =>
['mediaId' =>
$id],
$this->faker->
randomElements($mediaIds,
random_int(2, 5
)));
}