/**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $indexer = $this->indexerRegistry->get(Config::DESIGN_CONFIG_GRID_INDEXER_ID);
     $indexer->reindexAll();
     $setup->endSetup();
 }
 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('*****@*****.**');
     $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('*****@*****.**');
     $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();
 }
 /**
  * {@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();
 }
 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();
 }
 /**
  * {@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();
 }
 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]);
 }
 /**
  * {@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 = ?' => '']);
 }
 /**
  * {@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();
 }
 /**
  * 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();
 }
 /**
  * @inheritdoc
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $this->_context = $context;
     $setup->startSetup();
     /* perform module specific operations */
     $this->_setup();
     $setup->endSetup();
 }
 /**
  * {@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();
 }
 /**
  * {@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();
 }
 /**
  * {@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();
 }
Exemple #14
0
 /**
  * @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();
 }
 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();
 }
Exemple #16
0
 /**
  * {@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();
 }
 /**
  * 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();
 }
Exemple #18
0
 /**
  * {@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();
 }
Exemple #19
0
 /**
  * {@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();
 }
 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();
 }
 /**
  * {@inheritdoc}
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var TaxSetup $taxSetup */
     $taxSetup = $this->taxSetupFactory->create(['resourceName' => 'tax_setup', 'setup' => $setup]);
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1', '<')) {
         //Update the tax_class_id attribute in the 'catalog_eav_attribute' table
         $taxSetup->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, 'tax_class_id', 'is_visible_in_advanced_search', false);
     }
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $data = ['title' => 'title', 'link' => 'link', 'status' => 'status', 'image_link' => 'image_link', 'thumbnail_label' => 'thumbnail_label', 'rating' => 'rating', 'short_description' => 'short_description', 'mag_id' => 'mag_id', 'visible' => 'visible', 'store_id' => 'store_id', 'is_in_stock' => 'is_in_stock', 'sku' => 'sku', 'category' => 'category', 'websites' => 'websites', 'news_from_date' => 'news_from_date', 'news_to_date' => 'news_to_date'];
     $id = 1;
     foreach ($data as $xml_field => $code_field) {
         $setup->getConnection()->insertForce($setup->getTable('celebros_mapping'), ['id' => $id, 'xml_field' => $xml_field, 'code_field' => $code_field]);
         $id++;
     }
     $setup->endSetup();
 }
Exemple #23
0
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $postSetup = $this->postSetupFactory->create(['setup' => $setup]);
     $postSetup->installEntities();
     $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
     $categorySetup->installEntities();
     $setup->endSetup();
     $this->eavConfig->clear();
     $category = $categorySetup->getCategoryFactory()->create();
     $category->setName(__('Blog'))->setParentId(null)->setPath('1')->setLevel(0)->setPosition(0)->setStatus(1)->save();
 }
Exemple #24
0
 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * Append virtual category related attributes  :
  * - is_virtual_category
  * - virtual_rule
  *
  * @param ModuleDataSetupInterface $setup   The setup interface
  * @param ModuleContextInterface   $context The module Context
  *
  * @return void
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $eavSetup->addAttribute(Category::ENTITY, 'is_virtual_category', ['type' => 'int', 'label' => 'Is virtual category', 'input' => null, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'required' => false, 'default' => 0, 'visible' => true, 'note' => "Is the category is virtual or not ?", 'sort_order' => 200, 'group' => 'General Information']);
     $eavSetup->addAttribute(Category::ENTITY, 'virtual_category_root', ['type' => 'int', 'label' => 'Virtual category root', 'input' => null, 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'required' => false, 'default' => 0, 'visible' => true, 'note' => "Root display of the virtual category (usefull to display a facet category on virtual).", 'sort_order' => 200, 'group' => 'General Information']);
     $eavSetup->addAttribute(Category::ENTITY, 'virtual_rule', ['type' => 'text', 'label' => 'Virtual rule', 'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL, 'backend' => 'Smile\\ElasticsuiteVirtualCategory\\Model\\Category\\Attribute\\Backend\\VirtualRule', 'required' => false, 'default' => null, 'visible' => true, 'note' => "Virtual category rule.", 'sort_order' => 210, 'group' => 'General Information']);
     // Force the frontend input to be null for these attributes since they are managed by code.
     $eavSetup->updateAttribute(Category::ENTITY, 'is_virtual_category', 'frontend_input', null);
     $eavSetup->updateAttribute(Category::ENTITY, 'virtual_category_root', 'frontend_input', null);
     $eavSetup->updateAttribute(Category::ENTITY, 'virtual_rule', 'frontend_input', null);
     $setup->endSetup();
 }
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     $employeeEntity = \Foggyline\Office\Model\Employee::ENTITY;
     $employeeSetup = $this->employeeSetupFactory->create(['setup' => $setup]);
     $employeeSetup->installEntities();
     $employeeSetup->addAttribute($employeeEntity, 'service_years', ['type' => 'int']);
     $employeeSetup->addAttribute($employeeEntity, 'dob', ['type' => 'datetime']);
     $employeeSetup->addAttribute($employeeEntity, 'salary', ['type' => 'decimal']);
     $employeeSetup->addAttribute($employeeEntity, 'vat_number', ['type' => 'varchar']);
     $employeeSetup->addAttribute($employeeEntity, 'note', ['type' => 'text']);
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var CustomerSetup $customerSetup */
     $customerSetup = $this->localizeSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     $attributes = ['firstnamekana' => ['type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false, 'system' => 0, 'sort_order' => 45, 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', 'position' => 45, 'label' => 'First name kana'], 'lastnamekana' => ['type' => 'varchar', 'input' => 'text', 'visible' => true, 'required' => false, 'system' => 0, 'sort_order' => 65, 'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}', 'position' => 65, 'label' => 'Last name kana']];
     foreach ($attributes as $code => $options) {
         $customerSetup->addAttribute(Customer::ENTITY, $code, $options);
         $customerSetup->addAttribute('customer_address', $code, $options);
     }
     $this->installCustomerForms($customerSetup, $attributes);
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->startSetup();
     if (version_compare($context->getVersion(), '2.0.1') < 0) {
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
         $attributeSetId = $categorySetup->getDefaultAttributeSetId($entityTypeId);
         $attributeGroup = $categorySetup->getAttributeGroup($entityTypeId, $attributeSetId, 'Images', 'attribute_group_name');
         if (isset($attributeGroup['attribute_group_name']) && $attributeGroup['attribute_group_name'] == 'Images') {
             // update General Group
             $categorySetup->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroup['attribute_group_id'], 'attribute_group_name', 'Images and Videos');
         }
     }
     if ($context->getVersion() && version_compare($context->getVersion(), '2.0.1') < 0) {
         $select = $setup->getConnection()->select()->from($setup->getTable('catalog_product_entity_group_price'), ['entity_id', 'all_groups', 'customer_group_id', new \Zend_Db_Expr('1'), 'value', 'website_id']);
         $select = $setup->getConnection()->insertFromSelect($select, $setup->getTable('catalog_product_entity_tier_price'), ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'value', 'website_id']);
         $setup->getConnection()->query($select);
         $categorySetupManager = $this->categorySetupFactory->create();
         $categorySetupManager->removeAttribute(\Magento\Catalog\Model\Product::ENTITY, 'group_price');
     }
     if (version_compare($context->getVersion(), '2.0.2') < 0) {
         // set new resource model paths
         /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
         $categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Category');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Category::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Category\\Attribute\\Collection');
         $categorySetup->updateAttribute(\Magento\Catalog\Model\Category::ENTITY, 'custom_design_from', 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_model', 'Magento\\Catalog\\Model\\ResourceModel\\Product');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'attribute_model', 'Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute');
         $categorySetup->updateEntityType(\Magento\Catalog\Model\Product::ENTITY, 'entity_attribute_collection', 'Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection');
     }
     $setup->endSetup();
 }
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $setup->getConnection()->insertForce($setup->getTable('cataloginventory_stock'), ['stock_id' => 1, 'stock_name' => 'Default']);
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $groupName = 'Product Details';
     $entityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSetId = $eavSetup->getAttributeSetId($entityTypeId, 'Default');
     $attribute = $eavSetup->getAttribute($entityTypeId, 'quantity_and_stock_status');
     if ($attribute) {
         $eavSetup->addAttributeToGroup($entityTypeId, $attributeSetId, $groupName, $attribute['attribute_id'], 60);
         $eavSetup->updateAttribute($entityTypeId, $attribute['attribute_id'], 'default_value', 1);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Install grouped product link type
      */
     $data = ['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'code' => 'super'];
     $setup->getConnection()->insertOnDuplicate($setup->getTable('catalog_product_link_type'), $data);
     /**
      * Install grouped product link attributes
      */
     $select = $setup->getConnection()->select()->from(['c' => $setup->getTable('catalog_product_link_attribute')])->where("c.link_type_id=?", \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED);
     $result = $setup->getConnection()->fetchAll($select);
     if (!$result) {
         $data = [['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'product_link_attribute_code' => 'position', 'data_type' => 'int'], ['link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, 'product_link_attribute_code' => 'qty', 'data_type' => 'decimal']];
         $setup->getConnection()->insertMultiple($setup->getTable('catalog_product_link_attribute'), $data);
     }
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $field = 'country_of_manufacture';
     $applyTo = explode(',', $eavSetup->getAttribute(Product::ENTITY, $field, 'apply_to'));
     if (!in_array('grouped', $applyTo)) {
         $applyTo[] = 'grouped';
         $eavSetup->updateAttribute(Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
     }
 }
 /**
  * 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]);
     // Add new customer attribute
     $customerSetup->addAttribute(Customer::ENTITY, 'customer_number', ['label' => 'Customer Number', 'input' => 'text', 'required' => false, 'sort_order' => 10, 'visible' => true, 'system' => false, 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true]);
     // add attribute to form
     /** @var  $attribute */
     $attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'customer_number');
     $attribute->setData('used_in_forms', ['adminhtml_customer']);
     $attribute->save();
     $setup->endSetup();
 }