I have below script for creating attribute set, sets are created, but none of the attributes are assigned to based on the Default.
How do i map the attributes sets to have the default attributes?
app\code\Custom\AttributeSet\Setup\UpgradeData.php
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
if(version_compare($context->getVersion(), '1.1', '<'))
{
$attributeSet = $this->attributeSetFactory->create();
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
$attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
$datas = [
[
'attribute_set_name' => 'Test Set10',
'entity_type_id' => $entityTypeId,
'sort_order' => 200,
],
[
'attribute_set_name' => 'Test Set20',
'entity_type_id' => $entityTypeId,
'sort_order' => 200,
],
[
'attribute_set_name' => 'Test Set30',
'entity_type_id' => $entityTypeId,
'sort_order' => 200,
]
];
foreach ($datas as $data) {
$attributeSet = $this->attributeSetFactory->create();
$attributeSet->setData($data);
$attributeSet->validate();
$attributeSet->initFromSkeleton($attributeSetId);
$attributeSet->save();
}
}
}