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


PHP AdapterInterface::dropTrigger方法代码示例

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


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

示例1: createDelta

 /**
  * Create delta for specified table
  *
  * @param string $documentName
  * @param string $deltaLogName
  * @param string $idKey
  * @return void
  */
 public function createDelta($documentName, $deltaLogName, $idKey)
 {
     if (!$this->resourceAdapter->isTableExists($deltaLogName)) {
         $triggerTable = $this->resourceAdapter->newTable($deltaLogName)->addColumn($idKey, \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, ['nullable' => false, 'primary' => true])->addColumn('operation', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT)->addColumn('processed', \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, null, ['nullable' => false, 'default' => 0]);
         $this->resourceAdapter->createTable($triggerTable);
     } else {
         $this->deleteAllRecords($deltaLogName);
     }
     foreach (Trigger::getListOfEvents() as $event) {
         $triggerName = $this->resourceAdapter->getTableName('trg_' . $documentName . '_after_' . strtolower($event));
         $statement = $this->buildStatement($event, $idKey, $deltaLogName);
         $trigger = $this->triggerFactory->create()->setTime(Trigger::TIME_AFTER)->setEvent($event)->setTable($documentName);
         $triggerKey = $documentName . $event . Trigger::TIME_AFTER;
         $triggerExists = $this->isTriggerExist($triggerKey);
         if ($triggerExists) {
             $triggerName = $this->triggers[$triggerKey]['trigger_name'];
             $oldTriggerStatement = $this->triggers[$triggerKey]['action_statement'];
             if (strpos($oldTriggerStatement, $statement) !== false) {
                 unset($trigger);
                 continue;
             }
             $trigger->addStatement($oldTriggerStatement);
             $this->resourceAdapter->dropTrigger($triggerName);
         }
         $trigger->addStatement($statement)->setName($triggerName);
         $this->resourceAdapter->createTrigger($trigger);
         if (!$triggerExists) {
             $this->triggers[$triggerKey] = 1;
         }
         unset($trigger);
     }
 }
开发者ID:victor-v-rad,项目名称:data-migration-tool,代码行数:40,代码来源:Mysql.php

示例2: remove

 /**
  * Remove subscription
  *
  * @return \Magento\Framework\Mview\View\SubscriptionInterface
  */
 public function remove()
 {
     foreach (Trigger::getListOfEvents() as $event) {
         $triggerName = $this->getAfterEventTriggerName($event);
         /** @var Trigger $trigger */
         $trigger = $this->triggerFactory->create()->setName($triggerName)->setTime(Trigger::TIME_AFTER)->setEvent($event)->setTable($this->resource->getTableName($this->getTableName()));
         // Add statements for linked views
         foreach ($this->getLinkedViews() as $view) {
             /** @var \Magento\Framework\Mview\ViewInterface $view */
             $trigger->addStatement($this->buildStatement($event, $view->getChangelog()));
         }
         $this->connection->dropTrigger($trigger->getName());
         // Re-create trigger if trigger used by linked views
         if ($trigger->getStatements()) {
             $this->connection->createTrigger($trigger);
         }
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Subscription.php


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