$mediaIds =
$ids->
all();
foreach (['product', 'category', 'order'
] as $entity) { $this->
createMediaCustomField($entity);
$this->
createMediaSelectCustomField($entity);
$this->
createMediaMultiSelectCustomField($entity);
} $product =
new ProductBuilder($ids, Uuid::
randomHex(), 100
);
$product->
price(100
);
$product->
customField('custom_field_media_product',
$ids->
get('media-1'
));
$product->
customField('custom_field_media_select_product',
$ids->
get('media-2'
));
$product->
customField('custom_field_media_multi_select_product',
[$ids->
get('media-2'
),
$ids->
get('media-3'
),
$ids->
get('media-4'
)]);
$products =
[$product->
build()];
$this->
getContainer()->
get('product.repository'
)->
create($products, Context::
createDefaultContext());
$category =
new CategoryBuilder($ids, 'Category'
);
$category->
customField('custom_field_media_category',
$ids->
get('media-5'
));
$category->
customField('custom_field_media_select_category',
$ids->
get('media-6'
));
$category->
customField('custom_field_media_multi_select_category',
[$ids->
get('media-7'
),
$ids->
get('media-8'
),
$ids->
get('media-9'
)]);