_eavSetupFactory = $eavSetupFactory; $this->_attributeRepositoryInterface = $attributeRepositoryInterface; $this->_attributeSetupFactory = $attributeSetupFactory; } public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { try { $this->_attributeRepositoryInterface->get(Product::ENTITY, 'kai_banner'); } catch (\Exception $ex) { $setup->startSetup(); $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute( Product::ENTITY, 'kai_banner', [ 'input' => 'select', 'type' => 'varchar', 'label' => 'Banner', 'required' => false, 'visible' => true, 'user_defined' => true, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'used_in_product_listing' => true, 'apply_to' => '', 'source' => \Kai\Banner\Model\KaiBannerValues::class, 'global' => ScopedAttributeInterface::SCOPE_GLOBAL, 'group' => 'General', ] ); $setup->endSetup(); } } }