28 private $productGeneratorFactory;
33 private $autoIncrement;
40 ProductGeneratorFactory $productGeneratorFactory,
43 $this->productGeneratorFactory = $productGeneratorFactory;
44 $this->autoIncrement = $autoIncrement;
56 $this->productGeneratorFactory->create([
58 'catalog_product_super_attribute_label' => [
60 'handler' =>
function (
$productId, $entityNumber, $fixture, $binds) {
61 foreach ($binds as &$bind) {
62 $bind[
'product_super_attribute_id'] = $this->generateSuperAttributeId(
63 $bind[
'product_super_attribute_id'],
71 'catalog_product_super_link' => [
73 'handler' =>
function (
$productId, $entityNumber, $fixture, $binds) {
74 foreach ($binds as &$bind) {
76 $bind[
'product_id'] = $this->generateSimpleProductId(
85 'catalog_product_relation' => [
87 'handler' =>
function (
$productId, $entityNumber, $fixture, $binds) {
88 foreach ($binds as &$bind) {
90 $bind[
'child_id'] = $this->generateSimpleProductId(
111 private function generateSuperAttributeId($superAttributeId, $entityNumber, array $fixture)
113 return $superAttributeId + ($entityNumber + 1) * $fixture[
'_attributes_count']
114 * $this->autoIncrement->getIncrement();
125 private function generateSimpleProductId($previousProductId, $entityNumber, array $fixture)
127 return $previousProductId + $entityNumber * $fixture[
'_variation_count'];
const SKIP_ENTITY_ID_BINDING
generate($products, $fixtureMap)
__construct(ProductGeneratorFactory $productGeneratorFactory, AutoIncrement $autoIncrement)