-
-
Save Vinai/e57e77788951d0e7179aa35e2150bfba to your computer and use it in GitHub Desktop.
Example setup script for the Mage2Kata episode 13: The Event Observer Kata.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Mage2Kata\EventObserver\Setup; | |
use Magento\Catalog\Model\Product; | |
use Magento\Eav\Setup\EavSetup; | |
use Magento\Framework\Setup\ModuleContextInterface; | |
use Magento\Framework\Setup\ModuleDataSetupInterface; | |
use Magento\Framework\Setup\UpgradeDataInterface; | |
class UpgradeData implements UpgradeDataInterface | |
{ | |
/** | |
* @var EavSetup | |
*/ | |
private $eavSetup; | |
public function __construct(EavSetup $eavSetup) | |
{ | |
$this->eavSetup = $eavSetup; | |
} | |
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | |
{ | |
$this->eavSetup->addAttribute(Product::ENTITY, 'magento_se_points', [ | |
'label' => 'Magento SE Points Value', | |
'type' => 'int', | |
'required' => 0, | |
'user_defined' => 1, | |
'comparable' => 1, | |
'visible_on_front' => 1, | |
'is_configurable' => 0, | |
'group' => 'Product Details', | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment