12 use Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\CollectionFactory;
19 private $attributeRepository;
24 private $productVariationBuilder;
37 \
Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository,
42 $this->productVariationBuilder = $productVariationBuilder;
61 $products = $this->productsFactory->create();
82 private function getAttributesForMatrix(
$options)
87 $configurable = $this->objectToArray(
$option);
92 foreach ($attributeOptions as $attributeOption) {
93 $configurable[
'options'][] = $this->objectToArray($attributeOption);
95 $configurable[
'attribute_code'] =
$attribute->getAttributeCode();
107 private function objectToArray(\
Magento\Framework\DataObject $object)
109 $data = $object->getData();
114 foreach (
$value as $nestedKey => $nestedValue) {
115 if (is_object($nestedValue)) {
116 $value[$nestedKey] = $this->objectToArray($nestedValue);
elseif(isset( $params[ 'redirect_parent']))
generateVariation(ProductInterface $product, $options)
__construct(\Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, ProductVariationsBuilder $productVariationBuilder, CollectionFactory $productsFactory)