我目前有以下代码创建一个新的属性集:
use Magento\Framework\ObjectManagerInterface;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class AttributeModel extends \Magento\Framework\Model\AbstractModel
{
const ENTITY_TYPE = \Magento\Catalog\Model\Product::ENTITY;
protected $_objectManager;
protected $_moduleDataSetup;
protected $_eavSetupFactory;
public function __construct(
ObjectManagerInterface $objectManager,
ModuleDataSetupInterface $moduleDataSetup,
EavSetupFactory $eavSetupFactory,
) {
$this->_objectManager = $objectManager;
$this->_moduleDataSetup = $moduleDataSetup;
$this->_eavSetupFactory = $eavSetupFactory;
}
public function createSet($name)
{
$eavSetup = $this->_eavSetupFactory->create([
'setup' => $this->_moduleDataSetup
]);
$eavSetup->addAttributeSet(self::ENTITY_TYPE, $name, 0);
}
}
但是,该集合没有分配给它的属性。我将如何根据默认设置创建集合,以便预先填充基本属性?
非常感谢任何帮助。