• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Setup\ModuleDataSetupInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\Setup\ModuleDataSetupInterface的典型用法代码示例。如果您正苦于以下问题:PHP ModuleDataSetupInterface类的具体用法?PHP ModuleDataSetupInterface怎么用?PHP ModuleDataSetupInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ModuleDataSetupInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: upgrade

 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $indexer = $this->indexerRegistry->get(Config::DESIGN_CONFIG_GRID_INDEXER_ID);
     $indexer->reindexAll();
     $setup->endSetup();
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:10,代码来源:UpgradeData.php


示例2: upgrade

 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $salesDepartment = $this->departmentFactory->create();
     $salesDepartment->setName('Sales');
     $salesDepartment->save();
     $employee = $this->employeeFactory->create();
     $employee->setDepartmentId($salesDepartment->getId());
     $employee->setEmail('[email protected]');
     $employee->setFirstName('John');
     $employee->setLastName('Doe');
     $employee->setServiceYears(3);
     $employee->setDob('1983-03-28');
     $employee->setSalary(3800.0);
     $employee->setVatNumber('GB123456789');
     $employee->setNote('Just some notes about John');
     $employee->save();
     $financeDepartment = $this->departmentFactory->create();
     $financeDepartment->setName('Finance');
     $financeDepartment->save();
     $employee = $this->employeeFactory->create();
     $employee->setDepartmentId($financeDepartment->getId());
     $employee->setEmail('[email protected]');
     $employee->setFirstName('Anna');
     $employee->setLastName('Doe');
     $employee->setServiceYears(5);
     $employee->setDob('1986-08-16');
     $employee->setSalary(4200.0);
     $employee->setVatNumber('GB223344556');
     $employee->setNote('Just some notes about Anna');
     $employee->save();
     $setup->endSetup();
 }
开发者ID:Galillei,项目名称:B05032-Foggyline_Office,代码行数:33,代码来源:UpgradeData.php


示例3: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /*
      * Report Event Types default data
      */
     $eventTypeData = [['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_VIEW, 'event_name' => 'catalog_product_view'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_SEND, 'event_name' => 'sendfriend_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_COMPARE, 'event_name' => 'catalog_product_compare_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_CART, 'event_name' => 'checkout_cart_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_PRODUCT_TO_WISHLIST, 'event_name' => 'wishlist_add_product'], ['event_type_id' => \Magento\Reports\Model\Event::EVENT_WISHLIST_SHARE, 'event_name' => 'wishlist_share']];
     foreach ($eventTypeData as $row) {
         $setup->getConnection()->insertForce($setup->getTable('report_event_types'), $row);
     }
     /**
      * Prepare database after data upgrade
      */
     $setup->endSetup();
     /**
      * Cms Page  with 'home' identifier page modification for report pages
      */
     /** @var $cms \Magento\Cms\Model\Page */
     $cms = $this->pageFactory->create();
     $cms->load('home', 'identifier');
     $reportLayoutUpdate = '<!--
 <referenceContainer name="right">
     <action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.viewed</argument></action>
     <action method="unsetChild"><argument name="alias" xsi:type="string">right.reports.product.compared</argument></action>
 </referenceContainer>-->';
     /*
      * Merge and save old layout update data with report layout data
      */
     $cms->setLayoutUpdateXml($cms->getLayoutUpdateXml() . $reportLayoutUpdate)->save();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:33,代码来源:InstallData.php


示例4: install

 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $helloText = $this->_helloTextFactory->create();
     $helloText->setData('product', 14)->setText('Das ist nur ein Test')->save();
     $setup->endSetup();
 }
开发者ID:TUDOCK,项目名称:tudockblog-magento2-example,代码行数:7,代码来源:InstallData.php


示例5: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $roleCollection = $this->authFactory->createRoleCollection()->addFieldToFilter('parent_id', 0)->addFieldToFilter('tree_level', 1)->addFieldToFilter('role_type', RoleGroup::ROLE_TYPE)->addFieldToFilter('user_id', 0)->addFieldToFilter('user_type', UserContextInterface::USER_TYPE_ADMIN)->addFieldToFilter('role_name', 'Administrators');
     if ($roleCollection->count() == 0) {
         $admGroupRole = $this->authFactory->createRole()->setData(['parent_id' => 0, 'tree_level' => 1, 'sort_order' => 1, 'role_type' => RoleGroup::ROLE_TYPE, 'user_id' => 0, 'user_type' => UserContextInterface::USER_TYPE_ADMIN, 'role_name' => 'Administrators'])->save();
     } else {
         foreach ($roleCollection as $item) {
             $admGroupRole = $item;
             break;
         }
     }
     $rulesCollection = $this->authFactory->createRulesCollection()->addFieldToFilter('role_id', $admGroupRole->getId())->addFieldToFilter('resource_id', 'all');
     if ($rulesCollection->count() == 0) {
         $this->authFactory->createRules()->setData(['role_id' => $admGroupRole->getId(), 'resource_id' => 'Magento_Backend::all', 'privileges' => null, 'permission' => 'allow'])->save();
     } else {
         /** @var \Magento\Authorization\Model\Rules $rule */
         foreach ($rulesCollection as $rule) {
             $rule->setData('resource_id', 'Magento_Backend::all')->save();
         }
     }
     /**
      * Delete rows by condition from authorization_rule
      */
     $setup->startSetup();
     $tableName = $setup->getTable('authorization_rule');
     if ($tableName) {
         $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']);
     }
     $setup->endSetup();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:33,代码来源:InstallData.php


示例6: install

 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $connection = $setup->getConnection();
     // add Pending Payu.pl status to Pending Payment state
     $connection->insert($setup->getTable('sales_order_status'), ['status' => 'pending_payupl', 'label' => 'Pending Payu.pl']);
     $connection->insert($setup->getTable('sales_order_status_state'), ['status' => 'pending_payupl', 'state' => 'pending_payment', 'is_default' => 0, 'visible_on_front' => 1]);
 }
开发者ID:tozwierz,项目名称:magento2_payupl,代码行数:7,代码来源:InstallData.php


示例7: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /*
      * Register themes
      */
     $setup->getEventManager()->dispatch('theme_registration_from_filesystem');
     /**
      * Update theme's data
      */
     $fileCollection = $this->createTheme();
     $fileCollection->setItemObjectClass('Magento\\Theme\\Model\\Theme\\Data');
     $resourceCollection = $this->createThemeResource();
     $resourceCollection->setItemObjectClass('Magento\\Theme\\Model\\Theme\\Data');
     /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
     foreach ($resourceCollection as $theme) {
         $themeType = $fileCollection->hasTheme($theme) ? \Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL : \Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL;
         $theme->setType($themeType)->save();
     }
     $fileCollection = $this->createTheme();
     $fileCollection->setItemObjectClass('Magento\\Theme\\Model\\Theme\\Data');
     $themeDbCollection = $this->createThemeResource();
     $themeDbCollection->setItemObjectClass('Magento\\Theme\\Model\\Theme\\Data');
     /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
     foreach ($fileCollection as $theme) {
         $dbTheme = $themeDbCollection->getThemeByFullPath($theme->getFullPath());
         $dbTheme->setCode($theme->getCode());
         $dbTheme->save();
     }
     /**
      * Update rows in theme
      */
     $setup->getConnection()->update($setup->getTable('theme'), ['area' => 'frontend'], ['area = ?' => '']);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:36,代码来源:InstallData.php


示例8: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Prepare database for install
      */
     $setup->startSetup();
     $quoteInstaller = $this->quoteSetupFactory->create(['resourceName' => 'quote_setup', 'setup' => $setup]);
     $salesInstaller = $this->salesSetupFactory->create(['resourceName' => 'sales_setup', 'setup' => $setup]);
     /**
      * Add paypal attributes to the:
      *  - sales/flat_quote_payment_item table
      *  - sales/flat_order table
      */
     $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_id', []);
     $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_status', []);
     $quoteInstaller->addAttribute('quote_payment', 'paypal_correlation_id', []);
     $salesInstaller->addAttribute('order', 'paypal_ipn_customer_notified', ['type' => 'int', 'visible' => false, 'default' => 0]);
     $data = [];
     $statuses = ['pending_paypal' => __('Pending PayPal'), 'paypal_reversed' => __('PayPal Reversed'), 'paypal_canceled_reversal' => __('PayPal Canceled Reversal')];
     foreach ($statuses as $code => $info) {
         $data[] = ['status' => $code, 'label' => $info];
     }
     $setup->getConnection()->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $data);
     /**
      * Prepare database after install
      */
     $setup->endSetup();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:31,代码来源:InstallData.php


示例9: install

 /**
  * Installs DB schema for a module
  *
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     /** @var CustomerSetup $customerSetup */
     $customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
     $customerSetup->addAttribute(Customer::ENTITY, 'client_idn', ['label' => 'Client IDN', 'input' => 'text', 'required' => false, 'sort_order' => 40, 'visible' => true, 'system' => false, 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true, 'used_in_forms', ['adminhtml_customer']]);
     $setup->endSetup();
 }
开发者ID:antonkril,项目名称:m2experience,代码行数:15,代码来源:InstallData.php


示例10: install

 /**
  * @inheritdoc
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $this->_context = $context;
     $setup->startSetup();
     /* perform module specific operations */
     $this->_setup();
     $setup->endSetup();
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:11,代码来源:Base.php


示例11: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup->createMigrationSetup();
     $setup->startSetup();
     $installer->appendClassAliasReplace('core_config_data', 'value', Migration::ENTITY_TYPE_MODEL, Migration::FIELD_CONTENT_TYPE_PLAIN, ['config_id']);
     $installer->doUpdateClassAliases();
     $setup->endSetup();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:InstallData.php


示例12: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup->createMigrationSetup();
     $setup->startSetup();
     $installer->appendClassAliasReplace('salesrule', 'conditions_serialized', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, ['rule_id']);
     $installer->appendClassAliasReplace('salesrule', 'actions_serialized', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, ['rule_id']);
     $installer->doUpdateClassAliases();
     $setup->endSetup();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:InstallData.php


示例13: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup->createMigrationSetup();
     $setup->startSetup();
     $installer->appendClassAliasReplace('widget_instance', 'instance_type', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, ['instance_id']);
     $installer->appendClassAliasReplace('layout_update', 'xml', \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, ['layout_update_id']);
     $installer->doUpdateClassAliases();
     $setup->endSetup();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:InstallData.php


示例14: install

 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * Installs Data for the module :
  *  - Create attribute on category to enable/disable name indexation for search
  *  - Update is anchor attribute (hidden frontend input, null source model, enabled by default).
  *
  * @param ModuleDataSetupInterface $setup   The setup interface
  * @param ModuleContextInterface   $context The module Context
  *
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $this->eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $this->addCategoryNameSearchAttribute();
     $this->updateCategoryIsAnchorAttribute();
     $this->updateDefaultValuesForNameAttributes();
     $this->getIndexer('elasticsuite_categories_fulltext')->reindexAll();
     $setup->endSetup();
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:22,代码来源:InstallData.php


示例15: install

 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $installer = $setup;
     $setup->startSetup();
     $connection = $installer->getConnection();
     $select = $connection->select();
     $select->from(['catalog_eav_attribute' => $installer->getTable('catalog_eav_attribute')], ['attribute_id', 'store_id' => new \Zend_Db_Expr(0)]);
     $connection->query($connection->insertFromSelect($select, $installer->getTable('genmato_multistoresearchfields_attribute_search_store'), ['attribute_id', 'store_id']));
     $setup->endSetup();
 }
开发者ID:Genmato,项目名称:M2_MultistoreSearchFields,代码行数:10,代码来源:InstallData.php


示例16: upgrade

 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         $connection = $setup->getConnection();
         $select = $connection->select()->from($this->relationProcessor->getTable('catalog_product_link'), ['product_id', 'linked_product_id'])->where('link_type_id = ?', Link::LINK_TYPE_GROUPED);
         $connection->query($connection->insertFromSelect($select, $this->relationProcessor->getMainTable(), ['parent_id', 'child_id'], AdapterInterface::INSERT_IGNORE));
     }
     $setup->endSetup();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:UpgradeData.php


示例17: install

 /**
  * Sets used_in_recommender for relevant attributes
  *
  * @param ModuleDataSetupInterface $setup
  * @param ModuleContextInterface $context
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->_eavSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     foreach ($this->_helper->getSystemAttributesToUseInRecommender() as $code) {
         $eavSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $code, 'used_in_recommender', true);
     }
     $setup->endSetup();
 }
开发者ID:halk,项目名称:recowise-magento2-demo,代码行数:17,代码来源:InstallData.php


示例18: install

 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Prepare database for install
      */
     $setup->startSetup();
     /**
      * PagSeguro Order Status
      */
     $statuses = ['pagseguro_iniciado' => __('PagSeguro Iniciado'), 'pagseguro_aguardando_pagamento' => __('PagSeguro Aguardando Pagamento'), 'pagseguro_cancelada' => __('PagSeguro Cancelada'), 'pagseguro_chargeback_debitado' => __('PagSeguro Chargeback Debitado'), 'pagseguro_devolvida' => __('PagSeguro Devolvida'), 'pagseguro_disponivel' => __('PagSeguro Disponível'), 'pagseguro_em_analise' => __('PagSeguro Em Análise'), 'pagseguro_em_contestacao' => __('PagSeguro Em Contestação'), 'pagseguro_em_disputa' => __('PagSeguro Em Disputa'), 'pagseguro_paga' => __('PagSeguro Paga')];
     foreach ($statuses as $code => $info) {
         $status[] = ['status' => $code, 'label' => $info];
         $state[] = ['status' => $code, 'state' => 'new', 'is_default' => 0, 'visible_on_front' => '1'];
     }
     $setup->getConnection()->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $status);
     /**
      * PagSeguro Order State
      */
     $state[0]['is_default'] = 1;
     $setup->getConnection()->insertArray($setup->getTable('sales_order_status_state'), ['status', 'state', 'is_default', 'visible_on_front'], $state);
     unset($data);
     /**
      * PagSeguro Store Reference
      */
     $data[] = ['scope' => 'default', 'scope_id' => 0, 'path' => 'pagseguro/store/reference', 'value' => \UOL\PagSeguro\Helper\Data::generateStoreReference()];
     $setup->getConnection()->insertArray($setup->getTable('core_config_data'), ['scope', 'scope_id', 'path', 'value'], $data);
     /**
      * Prepare database after install
      */
     $setup->endSetup();
 }
开发者ID:pagseguro,项目名称:magento2,代码行数:34,代码来源:InstallData.php


示例19: upgrade

 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create();
         $groupId = (int) $eavSetup->getAttributeGroupByCode(Product::ENTITY, 'Default', 'image-management', 'attribute_group_id');
         $eavSetup->addAttributeToGroup(Product::ENTITY, 'Default', $groupId, 'swatch_image');
     }
     $setup->endSetup();
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:14,代码来源:UpgradeData.php


示例20: upgrade

 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1') < 0) {
         /** @var EavSetup $eavSetup */
         $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
         $entityTypeId = $eavSetup->getEntityTypeId(Product::ENTITY);
         $eavSetup->addAttribute($entityTypeId, 'sample', ['type' => 'varchar', 'label' => 'Sample', 'input' => 'multiselect', 'global' => ScopedAttributeInterface::SCOPE_STORE, 'backend' => 'Magento\\Eav\\Model\\Entity\\Attribute\\Backend\\ArrayBackend', 'group' => 'Sample Group', 'visible_on_front' => 1, 'option' => ['values' => [0 => 'Sample Option One', 1 => 'Sample Option Two']]]);
     }
     $setup->endSetup();
 }
开发者ID:andrew-smart,项目名称:magento2-sample-module,代码行数:11,代码来源:UpgradeData.php



注:本文中的Magento\Framework\Setup\ModuleDataSetupInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Setup\SchemaSetupInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Setup\ModuleContextInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap