当前位置: 首页>>代码示例>>PHP>>正文


PHP AdapterInterface::insertMultiple方法代码示例

本文整理汇总了PHP中Magento\Framework\DB\Adapter\AdapterInterface::insertMultiple方法的典型用法代码示例。如果您正苦于以下问题:PHP AdapterInterface::insertMultiple方法的具体用法?PHP AdapterInterface::insertMultiple怎么用?PHP AdapterInterface::insertMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\DB\Adapter\AdapterInterface的用法示例。


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

示例1: testInsertMultiple

 /**
  * @dataProvider insertDataProvider
  */
 public function testInsertMultiple($data)
 {
     $this->_connection->insertMultiple($this->_tableName, $data);
     $select = $this->_connection->select()->from($this->_tableName);
     $result = $this->_connection->fetchRow($select);
     $this->assertEquals($data, $result);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:InterfaceTest.php

示例2: insertMultiple

 /**
  * Insert multiple
  *
  * @param array $data
  * @return void
  * @throws \Magento\Framework\Exception\AlreadyExistsException
  * @throws \Exception
  */
 protected function insertMultiple($data)
 {
     try {
         $this->connection->insertMultiple($this->resource->getTableName(self::TABLE_NAME), $data);
     } catch (\Exception $e) {
         if ($e->getCode() === self::ERROR_CODE_DUPLICATE_ENTRY && preg_match('#SQLSTATE\\[23000\\]: [^:]+: 1062[^\\d]#', $e->getMessage())) {
             throw new \Magento\Framework\Exception\AlreadyExistsException(__('URL key for specified store already exists.'));
         }
         throw $e;
     }
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:19,代码来源:DbStorage.php

示例3: insertMultiple

 /**
  * Insert multiple
  *
  * @param array $data
  * @return void
  * @throws DuplicateEntryException
  * @throws \Exception
  */
 protected function insertMultiple($data)
 {
     try {
         $this->connection->insertMultiple($this->resource->getTableName(self::TABLE_NAME), $data);
     } catch (\Exception $e) {
         if ($e->getCode() === self::ERROR_CODE_DUPLICATE_ENTRY && preg_match('#SQLSTATE\\[23000\\]: [^:]+: 1062[^\\d]#', $e->getMessage())) {
             throw new DuplicateEntryException();
         }
         throw $e;
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:DbStorage.php

示例4: insertRecords

 /**
  * @inheritdoc
  */
 public function insertRecords($documentName, $records, $updateOnDuplicate = false)
 {
     $this->resourceAdapter->rawQuery("SET @OLD_INSERT_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
     if ($updateOnDuplicate) {
         $result = $this->resourceAdapter->insertOnDuplicate($documentName, $records);
     } else {
         $result = $this->resourceAdapter->insertMultiple($documentName, $records);
     }
     $this->resourceAdapter->rawQuery("SET SQL_MODE=IFNULL(@OLD_INSERT_SQL_MODE,'')");
     return $result;
 }
开发者ID:rsavchuk,项目名称:data-migration-tool-ce,代码行数:14,代码来源:Mysql.php

示例5: updateRuleProductData

 /**
  * @param Rule $rule
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function updateRuleProductData(Rule $rule)
 {
     $ruleId = $rule->getId();
     if ($rule->getProductsFilter()) {
         $this->connection->delete($this->getTable('catalogrule_product'), ['rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter()]);
     } else {
         $this->connection->delete($this->getTable('catalogrule_product'), $this->connection->quoteInto('rule_id=?', $ruleId));
     }
     if (!$rule->getIsActive()) {
         return $this;
     }
     $websiteIds = $rule->getWebsiteIds();
     if (!is_array($websiteIds)) {
         $websiteIds = explode(',', $websiteIds);
     }
     if (empty($websiteIds)) {
         return $this;
     }
     \Magento\Framework\Profiler::start('__MATCH_PRODUCTS__');
     $productIds = $rule->getMatchingProductIds();
     \Magento\Framework\Profiler::stop('__MATCH_PRODUCTS__');
     $customerGroupIds = $rule->getCustomerGroupIds();
     $fromTime = strtotime($rule->getFromDate());
     $toTime = strtotime($rule->getToDate());
     $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
     $sortOrder = (int) $rule->getSortOrder();
     $actionOperator = $rule->getSimpleAction();
     $actionAmount = $rule->getDiscountAmount();
     $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
     $subActionAmount = $rule->getSubDiscountAmount();
     $actionStop = $rule->getStopRulesProcessing();
     $rows = [];
     foreach ($productIds as $productId => $validationByWebsite) {
         foreach ($websiteIds as $websiteId) {
             if (empty($validationByWebsite[$websiteId])) {
                 continue;
             }
             foreach ($customerGroupIds as $customerGroupId) {
                 $rows[] = ['rule_id' => $ruleId, 'from_time' => $fromTime, 'to_time' => $toTime, 'website_id' => $websiteId, 'customer_group_id' => $customerGroupId, 'product_id' => $productId, 'action_operator' => $actionOperator, 'action_amount' => $actionAmount, 'action_stop' => $actionStop, 'sort_order' => $sortOrder, 'sub_simple_action' => $subActionOperator, 'sub_discount_amount' => $subActionAmount];
                 if (count($rows) == $this->batchCount) {
                     $this->connection->insertMultiple($this->getTable('catalogrule_product'), $rows);
                     $rows = [];
                 }
             }
         }
     }
     if (!empty($rows)) {
         $this->connection->insertMultiple($this->getTable('catalogrule_product'), $rows);
     }
     return $this;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:57,代码来源:IndexBuilder.php

示例6: doAddMultiple

 /**
  * {@inheritdoc}
  */
 protected function doAddMultiple($data)
 {
     $this->connection->insertMultiple(self::TABLE_NAME, $data);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:Db.php

示例7: _saveSpecificTypeValues

 /**
  * Save custom option type values
  *
  * @param array $typeValues Option type values
  * @return $this
  */
 protected function _saveSpecificTypeValues(array $typeValues)
 {
     $this->_deleteSpecificTypeValues(array_keys($typeValues));
     $typeValueRows = array();
     foreach ($typeValues as $optionId => $optionInfo) {
         foreach ($optionInfo as $row) {
             $row['option_id'] = $optionId;
             $typeValueRows[] = $row;
         }
     }
     if ($typeValueRows) {
         $this->_connection->insertMultiple($this->_tables['catalog_product_option_type_value'], $typeValueRows);
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:Option.php


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