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


PHP AdapterInterface::dropTable方法代碼示例

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


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

示例1: drop

 /**
  * Drop changelog table
  *
  * @return void
  * @throws \Exception
  */
 public function drop()
 {
     $changelogTableName = $this->resource->getTableName($this->getName());
     if (!$this->connection->isTableExists($changelogTableName)) {
         throw new \Exception("Table {$changelogTableName} does not exist");
     }
     $this->connection->dropTable($changelogTableName);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:Changelog.php

示例2: drop

 /**
  * Drop changelog table
  *
  * @return void
  * @throws ChangelogTableNotExistsException
  */
 public function drop()
 {
     $changelogTableName = $this->resource->getTableName($this->getName());
     if (!$this->connection->isTableExists($changelogTableName)) {
         throw new ChangelogTableNotExistsException(new Phrase("Table %1 does not exist", [$changelogTableName]));
     }
     $this->connection->dropTable($changelogTableName);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:14,代碼來源:Changelog.php

示例3: deleteBackup

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

示例4: _cleanOnFailure

 /**
  * Drop temporary tables created by reindex process
  *
  * @param array $tablesList
  * @param int|string $storeId
  * @return void
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 protected function _cleanOnFailure(array $tablesList, $storeId)
 {
     foreach ($tablesList as $table => $columns) {
         $this->_connection->dropTemporaryTable($table);
     }
     $tableName = $this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId));
     $this->_connection->dropTable($tableName);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:16,代碼來源:AbstractAction.php

示例5: _createTemporaryFlatTable

 /**
  * Prepare flat table for store
  *
  * @param int|string $storeId
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _createTemporaryFlatTable($storeId)
 {
     $columns = $this->_productIndexerHelper->getFlatColumns();
     $indexesNeed = $this->_productIndexerHelper->getFlatIndexes();
     $maxIndex = $this->_config->getValue(self::XML_NODE_MAX_INDEX_COUNT);
     if ($maxIndex && count($indexesNeed) > $maxIndex) {
         throw new \Magento\Framework\Exception\LocalizedException(__('The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes.' . 'Currently there are %1$d of them.' . 'Please reduce the number of filterable/sortable attributes in order to use this module', count($indexesNeed), $maxIndex));
     }
     $indexKeys = [];
     $indexProps = array_values($indexesNeed);
     $upperPrimaryKey = strtoupper(\Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY);
     foreach ($indexProps as $i => $indexProp) {
         $indexName = $this->_connection->getIndexName($this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)), $indexProp['fields'], $indexProp['type']);
         $indexProp['type'] = strtoupper($indexProp['type']);
         if ($indexProp['type'] == $upperPrimaryKey) {
             $indexKey = $upperPrimaryKey;
         } else {
             $indexKey = $indexName;
         }
         $indexProps[$i] = ['KEY_NAME' => $indexName, 'COLUMNS_LIST' => $indexProp['fields'], 'INDEX_TYPE' => strtolower($indexProp['type'])];
         $indexKeys[$i] = $indexKey;
     }
     $indexesNeed = array_combine($indexKeys, $indexProps);
     /** @var $table \Magento\Framework\DB\Ddl\Table */
     $table = $this->_connection->newTable($this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)));
     foreach ($columns as $fieldName => $fieldProp) {
         $columnLength = isset($fieldProp['length']) ? $fieldProp['length'] : null;
         $columnDefinition = ['nullable' => isset($fieldProp['nullable']) ? (bool) $fieldProp['nullable'] : false, 'unsigned' => isset($fieldProp['unsigned']) ? (bool) $fieldProp['unsigned'] : false, 'default' => isset($fieldProp['default']) ? $fieldProp['default'] : false, 'primary' => false];
         $columnComment = isset($fieldProp['comment']) ? $fieldProp['comment'] : $fieldName;
         $table->addColumn($fieldName, $fieldProp['type'], $columnLength, $columnDefinition, $columnComment);
     }
     foreach ($indexesNeed as $indexProp) {
         $table->addIndex($indexProp['KEY_NAME'], $indexProp['COLUMNS_LIST'], ['type' => $indexProp['INDEX_TYPE']]);
     }
     $table->setComment("Catalog Product Flat (Store {$storeId})");
     $this->_connection->dropTable($this->_getTemporaryTableName($this->_productIndexerHelper->getFlatTableName($storeId)));
     $this->_connection->createTable($table);
 }
開發者ID:koliaGI,項目名稱:magento2,代碼行數:47,代碼來源:FlatTableBuilder.php

示例6: dropTable

 /**
  * @param AdapterInterface $connection
  * @param string $tableName
  * @return void
  */
 private function dropTable(AdapterInterface $connection, $tableName)
 {
     if ($connection->isTableExists($tableName)) {
         $connection->dropTable($tableName);
     }
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:11,代碼來源:IndexStructure.php

示例7: tearDown

 /**
  * Cleanup DDL cache for the fixture table
  */
 protected function tearDown()
 {
     $this->_connection->dropTable($this->_tableName);
     $this->_connection->resetDdlCache($this->_tableName);
     $this->_connection = null;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:9,代碼來源:InterfaceTest.php

示例8: dropTable

 /**
  * @param AdapterInterface $adapter
  * @param string $tableName
  * @return void
  */
 private function dropTable(AdapterInterface $adapter, $tableName)
 {
     if ($adapter->isTableExists($tableName)) {
         $adapter->dropTable($tableName);
     }
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:11,代碼來源:IndexStructure.php


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