Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace ...;
- use MagentoEavSetupEavSetupFactory;
- use MagentoFrameworkSetupInstallDataInterface;
- use MagentoFrameworkSetupModuleContextInterface;
- use MagentoFrameworkSetupModuleDataSetupInterface;
- class InstallData implements InstallDataInterface
- {
- /**
- * EAV setup factory
- *
- * @var EavSetupFactory
- */
- private $eavSetupFactory;
- /**
- * Init
- *
- * @param EavSetupFactory $eavSetupFactory
- */
- public function __construct(EavSetupFactory $eavSetupFactory)
- {
- $this->eavSetupFactory = $eavSetupFactory;
- }
- /**
- * {@inheritdoc}
- */
- public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
- {
- $setup->startSetup();
- $setup->getConnection()->query("INSERT INTO `sales_order_status`(`status`, `label`) VALUES ('test','Test')");
- $setup->endSetup();
- }
- }
- namespace {VendorName}{ModuleName}Setup;
- use MagentoFrameworkConfigConfigOptionsListConstants;
- class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
- {
- /**
- * @var MagentoFrameworkAppDeploymentConfig
- */
- protected $deploymentConfig;
- public function __construct(
- MagentoFrameworkAppDeploymentConfig $deploymentConfig
- ) {
- $this->deploymentConfig = $deploymentConfig;
- }
- public function getTablePrefix()
- {
- return $this->deploymentConfig->get(
- ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX
- );
- }
- namespace ...;
- use MagentoEavSetupEavSetupFactory;
- use MagentoFrameworkSetupInstallDataInterface;
- use MagentoFrameworkSetupModuleContextInterface;
- use MagentoFrameworkSetupModuleDataSetupInterface;
- class InstallData implements InstallDataInterface
- {
- /**
- * EAV setup factory
- *
- * @var EavSetupFactory
- */
- private $eavSetupFactory;
- /**
- * Init
- *
- * @param EavSetupFactory $eavSetupFactory
- */
- public function __construct(EavSetupFactory $eavSetupFactory)
- {
- $this->eavSetupFactory = $eavSetupFactory;
- }
- /**
- * {@inheritdoc}
- */
- public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
- {
- $setup->startSetup();
- $tableName = $setup->getTable('sales_order_status');
- $setup->getConnection()->query('INSERT INTO `'.$tableName.'` (`status`, `label`) VALUES ('test','Test')');
- $setup->endSetup();
- }
- }
Add Comment
Please, Sign In to add comment