當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AdapterInterface::insertFromSelect方法代碼示例

本文整理匯總了PHP中Magento\Framework\DB\Adapter\AdapterInterface::insertFromSelect方法的典型用法代碼示例。如果您正苦於以下問題:PHP AdapterInterface::insertFromSelect方法的具體用法?PHP AdapterInterface::insertFromSelect怎麽用?PHP AdapterInterface::insertFromSelect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\DB\Adapter\AdapterInterface的用法示例。


在下文中一共展示了AdapterInterface::insertFromSelect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: reindexRootCategory

 /**
  * Reindex all products to root category
  *
  * @param \Magento\Store\Model\Store $store
  * @return void
  */
 protected function reindexRootCategory(\Magento\Store\Model\Store $store)
 {
     if ($this->isIndexRootCategoryNeeded()) {
         $selects = $this->prepareSelectsByRange($this->getAllProducts($store), 'entity_id', self::RANGE_PRODUCT_STEP);
         foreach ($selects as $select) {
             $this->connection->query($this->connection->insertFromSelect($select, $this->getMainTmpTable(), ['category_id', 'product_id', 'position', 'is_parent', 'store_id', 'visibility'], \Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE));
         }
     }
 }
開發者ID:rafaelstz,項目名稱:magento2,代碼行數:15,代碼來源:AbstractAction.php

示例2: _insertFromTable

 /**
  * Copy data from source table to destination
  *
  * @param string $sourceTable
  * @param string $destTable
  * @param null|string $where
  * @return void
  */
 protected function _insertFromTable($sourceTable, $destTable, $where = null)
 {
     $sourceColumns = array_keys($this->_connection->describeTable($sourceTable));
     $targetColumns = array_keys($this->_connection->describeTable($destTable));
     $select = $this->_connection->select()->from($sourceTable, $sourceColumns);
     if ($where) {
         $select->where($where);
     }
     $query = $this->_connection->insertFromSelect($select, $destTable, $targetColumns, \Magento\Framework\DB\Adapter\AdapterInterface::INSERT_ON_DUPLICATE);
     $this->_connection->query($query);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:19,代碼來源:AbstractAction.php

示例3: rollbackDocument

 /**
  * @inheritdoc
  */
 public function rollbackDocument($documentName)
 {
     $backupTableName = self::BACKUP_DOCUMENT_PREFIX . $documentName;
     if ($this->resourceAdapter->isTableExists($backupTableName)) {
         $this->resourceAdapter->truncateTable($documentName);
         $select = $this->resourceAdapter->select()->from($backupTableName);
         $query = $this->resourceAdapter->insertFromSelect($select, $documentName);
         $this->resourceAdapter->query($query);
         $this->resourceAdapter->dropTable($backupTableName);
     }
 }
開發者ID:victor-v-rad,項目名稱:data-migration-tool,代碼行數:14,代碼來源:Mysql.php


注:本文中的Magento\Framework\DB\Adapter\AdapterInterface::insertFromSelect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。