I wrote an extension to import products from an XML-file. It is working (for now), but I am using a ->save() method on the Class MagentoConfigurableProductModelProductTypeConfigurableAttributeFactory
:
$attributeModel = $this->configurableAttributeFactory->create();
$attributes = [$attributeId];
foreach ($attributes as $key => $attributeId) {
$data = ['attribute_id' => $attributeId, 'product_id' => $productId, 'position' => $key];
$attributeModel->setData($data);
$attributeModel->save(); /* <<< deprecated method */
}
The save() method seems to be deprecated, and I want to update the extension. So, what is the proper alternative? I already changed the saving-method for the products, to use the resource Model, but I dont know, how to change it for the configurable attributes.