本文整理汇总了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));
}
}
}
示例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);
}
示例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);
}
}