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


PHP AdapterInterface::delete方法代码示例

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


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

示例1: executeFull

 /**
  * Execute full indexation
  *
  * @return void
  */
 public function executeFull()
 {
     $results = [];
     foreach ($this->getTables() as $table => $columns) {
         if (!count($columns)) {
             continue;
         }
         foreach ($columns as $idx => $col) {
             $columns[$idx] = '`' . $col . '`';
         }
         $select = $this->connection->select();
         $fromColumns = new \Zend_Db_Expr('CONCAT(' . implode(",' ',", $columns) . ') as data_index');
         $select->from($table, $fromColumns);
         $result = $this->connection->query($select);
         while ($row = $result->fetch()) {
             $data = $row['data_index'];
             $this->split($data, $results);
         }
     }
     $indexTable = $this->resource->getTableName('mst_misspell_index');
     $this->connection->delete($indexTable);
     $rows = [];
     foreach ($results as $word => $freq) {
         $rows[] = ['keyword' => $word, 'trigram' => $this->text->getTrigram($word), 'frequency' => $freq / count($results)];
         if (count($rows) > 1000) {
             $this->connection->insertArray($indexTable, ['keyword', 'trigram', 'frequency'], $rows);
             $rows = [];
         }
     }
     if (count($rows) > 0) {
         $this->connection->insertArray($indexTable, ['keyword', 'trigram', 'frequency'], $rows);
     }
     $this->connection->delete($this->resource->getTableName('mst_misspell_suggest'));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:39,代码来源:Indexer.php

示例2: deleteProductsFromStore

 /**
  * Delete products from flat table(s)
  *
  * @param int|array $productId
  * @param null|int $storeId
  * @return void
  */
 public function deleteProductsFromStore($productId, $storeId = null)
 {
     if (!is_array($productId)) {
         $productId = [$productId];
     }
     if (null === $storeId) {
         foreach ($this->storeManager->getStores() as $store) {
             $this->connection->delete($this->productIndexerHelper->getFlatTableName($store->getId()), ['entity_id IN(?)' => $productId]);
         }
     } else {
         $this->connection->delete($this->productIndexerHelper->getFlatTableName((int) $storeId), ['entity_id IN(?)' => $productId]);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:20,代码来源:Eraser.php

示例3: removeNode

 /**
  * @param string|int $nodeId
  * @return bool|Node|void
  */
 public function removeNode($nodeId)
 {
     $info = $this->getNodeInfo($nodeId);
     if (!$info) {
         return false;
     }
     if ($nodeId) {
         $this->_db->beginTransaction();
         try {
             /**
              * DELETE FROM my_tree WHERE left_key >= $left_key AND right_key <= $right_key
              */
             $this->_db->delete($this->_table, $this->_left . ' >= ' . $info[$this->_left] . ' AND ' . $this->_right . ' <= ' . $info[$this->_right]);
             /**
              * UPDATE my_tree SET left_key = IF(left_key > $left_key, left_key – ($right_key - $left_key + 1),
              *      left_key), right_key = right_key – ($right_key - $left_key + 1) WHERE right_key > $right_key
              */
             $sql = 'UPDATE ' . $this->_table . ' SET ' . $this->_left . ' = IF(' . $this->_left . ' > ' . $info[$this->_left] . ', ' . $this->_left . ' - ' . ($info[$this->_right] - $info[$this->_left] + 1) . ', ' . $this->_left . '), ' . $this->_right . ' = ' . $this->_right . ' - ' . ($info[$this->_right] - $info[$this->_left] + 1) . ' WHERE ' . $this->_right . ' > ' . $info[$this->_right];
             $this->_db->query($sql);
             $this->_db->commit();
             return new Node($info, $this->getKeys());
         } catch (\Exception $e) {
             $this->_db->rollBack();
             echo $e->getMessage();
         }
     }
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:31,代码来源:Tree.php

示例4: clear

 /**
  * Clear changelog table by version_id
  *
  * @param int $versionId
  * @return boolean
  * @throws \Exception
  */
 public function clear($versionId)
 {
     $changelogTableName = $this->resource->getTableName($this->getName());
     if (!$this->connection->isTableExists($changelogTableName)) {
         throw new \Exception("Table {$changelogTableName} does not exist");
     }
     $this->connection->delete($changelogTableName, ['version_id <= ?' => (int) $versionId]);
     return true;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Changelog.php

示例5: deleteIndex

 /**
  * {@inheritdoc}
  */
 public function deleteIndex($dimensions, \Traversable $documents)
 {
     foreach ($this->dataTypes as $dataType) {
         foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
             $documentsId = array_column($batchDocuments, 'id');
             $this->connection->delete($this->getTableName($dataType, $dimensions), ['id' => $documentsId]);
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:IndexerHandler.php

示例6: deleteOptionsAndSelections

 /**
  * Delete options and selections.
  *
  * @param array $productIds
  *
  * @return \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
  */
 protected function deleteOptionsAndSelections($productIds)
 {
     $optionTable = $this->_resource->getTableName('catalog_product_bundle_option');
     $optionValueTable = $this->_resource->getTableName('catalog_product_bundle_option_value');
     $valuesIds = $this->connection->fetchAssoc($this->connection->select()->from(['bov' => $optionValueTable], ['value_id'])->joinLeft(['bo' => $optionTable], 'bo.option_id = bov.option_id', ['option_id'])->where('parent_id IN (?)', $productIds));
     $this->connection->delete($optionTable, $this->connection->quoteInto('value_id IN (?)', array_keys($valuesIds)));
     $productIdsInWhere = $this->connection->quoteInto('parent_id IN (?)', $productIds);
     $this->connection->delete($optionTable, $this->connection->quoteInto('parent_id IN (?)', $productIdsInWhere));
     $this->connection->delete($optionTable, $this->connection->quoteInto('parent_product_id IN (?)', $productIdsInWhere));
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:18,代码来源:Bundle.php

示例7: removeNode

 /**
  * @param Node $node
  * @return $this
  * @throws \Exception
  */
 public function removeNode($node)
 {
     // For reorder old node branch
     $dataReorderOld = [$this->_orderField => new \Zend_Db_Expr($this->_conn->quoteIdentifier($this->_orderField) . '-1')];
     $conditionReorderOld = $this->_conn->quoteIdentifier($this->_parentField) . '=' . $node->getData($this->_parentField) . ' AND ' . $this->_conn->quoteIdentifier($this->_orderField) . '>' . $node->getData($this->_orderField);
     $this->_conn->beginTransaction();
     try {
         $condition = $this->_conn->quoteInto("{$this->_idField}=?", $node->getId());
         $this->_conn->delete($this->_table, $condition);
         // Update old node branch
         $this->_conn->update($this->_table, $dataReorderOld, $conditionReorderOld);
         $this->_conn->commit();
     } catch (\Exception $e) {
         $this->_conn->rollBack();
         throw new \Exception('Can\'t remove tree node');
     }
     parent::removeNode($node);
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Db.php

示例8: _emptyTable

 /**
  * Removes all data from the table
  *
  * @param string $table
  * @return void
  */
 protected function _emptyTable($table)
 {
     $this->_connection->delete($table);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:AbstractAction.php

示例9: _deleteData

 /**
  * Delete unnecessary links.
  *
  * @return $this
  */
 protected function _deleteData()
 {
     $linkTable = $this->_resource->getTableName('catalog_product_super_link');
     $relationTable = $this->_resource->getTableName('catalog_product_relation');
     if ($this->_entityModel->getBehavior() == \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND && !empty($this->_productSuperData['product_id']) && !empty($this->_simpleIdsToDelete)) {
         $quoted = $this->_connection->quoteInto('IN (?)', [$this->_productSuperData['product_id']]);
         $quotedChildren = $this->_connection->quoteInto('IN (?)', $this->_simpleIdsToDelete);
         $this->_connection->delete($linkTable, "parent_id {$quoted} AND product_id {$quotedChildren}");
         $this->_connection->delete($relationTable, "parent_id {$quoted} AND child_id {$quotedChildren}");
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Configurable.php

示例10: gc

 /**
  * Garbage collection
  *
  * @param int $maxLifeTime
  * @return bool
  * @SuppressWarnings(PHPMD.ShortMethodName)
  */
 public function gc($maxLifeTime)
 {
     $where = ['session_expires < ?' => time() - $maxLifeTime];
     $this->_write->delete($this->_sessionTable, $where);
     return true;
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:13,代码来源:DbTable.php

示例11: delete

 /**
  * Process delete action
  *
  * @param TransactionManagerInterface $transactionManager
  * @param Connection $connection
  * @param string $table
  * @param string $condition
  * @param array $involvedData
  * @return void
  * @throws \LogicException
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function delete(TransactionManagerInterface $transactionManager, Connection $connection, $table, $condition, array $involvedData)
 {
     $connection->delete($table, $condition);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:ObjectRelationProcessor.php

示例12: deleteOldData

 /**
  * Clean rule price index
  *
  * @return $this
  */
 protected function deleteOldData()
 {
     $this->connection->delete($this->getTable('catalogrule_product_price'));
     return $this;
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:10,代码来源:IndexBuilder.php

示例13: deleteProcessedRecords

 /**
  * Delete processed records
  *
  * @param string $documentName
  * @return void
  */
 public function deleteProcessedRecords($documentName)
 {
     $this->resourceAdapter->delete($documentName, "`processed` = 1");
 }
开发者ID:victor-v-rad,项目名称:data-migration-tool,代码行数:10,代码来源:Mysql.php

示例14: _deleteSpecificTypeValues

 /**
  * Delete custom option type values
  *
  * @param array $optionIds
  * @return $this
  */
 protected function _deleteSpecificTypeValues(array $optionIds)
 {
     $this->_connection->delete($this->_tables['catalog_product_option_type_value'], $this->_connection->quoteInto('option_id IN (?)', $optionIds));
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Option.php

示例15: deleteOldLinks

 /**
  * @param array $productIds
  * @throws \Magento\Framework\Exception\LocalizedException
  * @return void
  */
 protected function deleteOldLinks($productIds)
 {
     if ($this->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND) {
         $this->connection->delete($this->productLink->getMainTable(), $this->connection->quoteInto('product_id IN (?) AND link_type_id = ' . $this->getLinkTypeId(), $productIds));
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:Links.php


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