| Current Path : /home/rtorresani/www/app/code/Torresani/IndacoDataPatch/Setup/ |
| Current File : //home/rtorresani/www/app/code/Torresani/IndacoDataPatch/Setup/InstallData.php |
<?php
namespace Torresani\IndacoDataPatch\Setup;
use Magento\Framework\Setup\{
ModuleContextInterface,
ModuleDataSetupInterface,
InstallDataInterface
};
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory) {
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(\Magento\Catalog\Model\Category::ENTITY, 'assignment_level', [
'type' => 'varchar',
'label' => 'Assignment level',
'input' => 'select',
'source' => 'Torresani\IndacoDataPatch\Model\Customer\Attribute\Source\AssignmentLevel',
'visible' => true,
'required' => false,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'group' => 'Display Settings',
]);
}
}