Guest User

Untitled

a guest
Oct 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php
  2.  
  3. namespace ...;
  4.  
  5.  
  6. use MagentoEavSetupEavSetupFactory;
  7. use MagentoFrameworkSetupInstallDataInterface;
  8. use MagentoFrameworkSetupModuleContextInterface;
  9. use MagentoFrameworkSetupModuleDataSetupInterface;
  10.  
  11. class InstallData implements InstallDataInterface
  12. {
  13. /**
  14. * EAV setup factory
  15. *
  16. * @var EavSetupFactory
  17. */
  18. private $eavSetupFactory;
  19.  
  20. /**
  21. * Init
  22. *
  23. * @param EavSetupFactory $eavSetupFactory
  24. */
  25. public function __construct(EavSetupFactory $eavSetupFactory)
  26. {
  27. $this->eavSetupFactory = $eavSetupFactory;
  28. }
  29.  
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  34. {
  35. $setup->startSetup();
  36.  
  37.  
  38. $setup->getConnection()->query("INSERT INTO `sales_order_status`(`status`, `label`) VALUES ('test','Test')");
  39.  
  40.  
  41.  
  42. $setup->endSetup();
  43. }
  44. }
  45.  
  46. namespace {VendorName}{ModuleName}Setup;
  47. use MagentoFrameworkConfigConfigOptionsListConstants;
  48.  
  49. class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
  50. {
  51.  
  52. /**
  53. * @var MagentoFrameworkAppDeploymentConfig
  54. */
  55. protected $deploymentConfig;
  56.  
  57. public function __construct(
  58. MagentoFrameworkAppDeploymentConfig $deploymentConfig
  59. ) {
  60.  
  61. $this->deploymentConfig = $deploymentConfig;
  62. }
  63. public function getTablePrefix()
  64. {
  65. return $this->deploymentConfig->get(
  66. ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX
  67. );
  68. }
  69.  
  70. namespace ...;
  71.  
  72.  
  73. use MagentoEavSetupEavSetupFactory;
  74. use MagentoFrameworkSetupInstallDataInterface;
  75. use MagentoFrameworkSetupModuleContextInterface;
  76. use MagentoFrameworkSetupModuleDataSetupInterface;
  77.  
  78. class InstallData implements InstallDataInterface
  79. {
  80. /**
  81. * EAV setup factory
  82. *
  83. * @var EavSetupFactory
  84. */
  85. private $eavSetupFactory;
  86.  
  87. /**
  88. * Init
  89. *
  90. * @param EavSetupFactory $eavSetupFactory
  91. */
  92. public function __construct(EavSetupFactory $eavSetupFactory)
  93. {
  94. $this->eavSetupFactory = $eavSetupFactory;
  95. }
  96.  
  97. /**
  98. * {@inheritdoc}
  99. */
  100. public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  101. {
  102. $setup->startSetup();
  103. $tableName = $setup->getTable('sales_order_status');
  104.  
  105. $setup->getConnection()->query('INSERT INTO `'.$tableName.'` (`status`, `label`) VALUES ('test','Test')');
  106. $setup->endSetup();
  107. }
  108. }
Add Comment
Please, Sign In to add comment