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


PHP TypeListInterface::cleanType方法代码示例

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


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

示例1: execute

 /**
  * Toggle cache
  *
  */
 public function execute()
 {
     $allTypes = array_keys($this->_cacheTypeList->getTypes());
     $updatedTypes = 0;
     $disable = true;
     $enable = true;
     foreach ($allTypes as $code) {
         if ($this->_cacheState->isEnabled($code) && $disable) {
             $this->_cacheState->setEnabled($code, false);
             $updatedTypes++;
             $enable = false;
         }
         if (!$this->_cacheState->isEnabled($code) && $enable) {
             $this->_cacheState->setEnabled($code, true);
             $updatedTypes++;
             $disable = false;
         }
         if ($disable) {
             $this->_cacheTypeList->cleanType($code);
         }
     }
     if ($updatedTypes > 0) {
         $this->_cacheState->persist();
         $this->messageManager->addSuccess(__("%1 cache type(s) disabled.", $updatedTypes));
     }
 }
开发者ID:dineshmalekar,项目名称:Magento2-Developer-Debug-Tool,代码行数:30,代码来源:Togglecache.php

示例2: install

 /**
  * {@inheritdoc}
  */
 public function install(array $fixtures)
 {
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('core_write');
     $regions = $this->loadDirectoryRegions();
     foreach ($fixtures as $fileName) {
         $fileName = $this->fixtureManager->getFixture($fileName);
         if (!file_exists($fileName)) {
             continue;
         }
         $rows = $this->csvReader->getData($fileName);
         $header = array_shift($rows);
         foreach ($rows as $row) {
             $data = [];
             foreach ($row as $key => $value) {
                 $data[$header[$key]] = $value;
             }
             $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
             try {
                 $adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsite()->getId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
             } catch (\Zend_Db_Statement_Exception $e) {
                 if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
                     // In case if Sample data was already installed we just skip duplicated records installation
                     continue;
                 } else {
                     throw $e;
                 }
             }
         }
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:37,代码来源:Tablerate.php

示例3: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing Tablerate:');
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */
     $connection = $this->resource->getConnection('core');
     $fixtureFile = 'OfflineShipping/tablerate.csv';
     $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
     $regions = $this->loadDirectoryRegions();
     /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
     $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
     foreach ($csvReader as $data) {
         $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
         try {
             $connection->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsiteId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
         } catch (\Zend_Db_Statement_Exception $e) {
             if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
                 // In case if Sample data was already installed we just skip duplicated records installation
                 continue;
             } else {
                 throw $e;
             }
         }
         $this->logger->logInline('.');
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:31,代码来源:Tablerate.php

示例4: execute

 /**
  * Set tax ignore notification flag and redirect back
  *
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute()
 {
     $section = $this->getRequest()->getParam('section');
     if ($section) {
         try {
             $path = 'tax/notification/ignore_' . $section;
             $this->_objectManager->get('Magento\\Config\\Model\\Resource\\Config')->saveConfig($path, 1, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT, 0);
         } catch (\Exception $e) {
             $this->messageManager->addError($e->getMessage());
         }
     }
     // clear the block html cache
     $this->_cacheTypeList->cleanType('block_html');
     $this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'block_html']);
     $this->getResponse()->setRedirect($this->_redirect->getRefererUrl());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:21,代码来源:IgnoreTaxNotification.php

示例5: execute

 /**
  * Set tax ignore notification flag and redirect back
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  */
 public function execute()
 {
     try {
         $path = \ClassyLlama\AvaTax\Helper\Config::XML_PATH_AVATAX_ADMIN_NOTIFICATION_IGNORE_NATIVE_TAX_RULES;
         $this->_objectManager->get('Magento\\Config\\Model\\ResourceModel\\Config')->saveConfig($path, 1, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, 0);
         $this->messageManager->addSuccess('Notification successfully ignored');
     } catch (\Exception $e) {
         $this->messageManager->addError($e->getMessage());
     }
     // clear the block html cache
     $this->cacheTypeList->cleanType('config');
     $this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'block_html']);
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setRefererUrl();
 }
开发者ID:classyllama,项目名称:ClassyLlama_AvaTax,代码行数:21,代码来源:IgnoreTaxRuleNotification.php

示例6: execute

 /**
  * Set tax ignore notification flag and redirect back
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  */
 public function execute()
 {
     $section = $this->getRequest()->getParam('section');
     if ($section) {
         try {
             $path = 'tax/notification/ignore_' . $section;
             $this->_objectManager->get('Magento\\Config\\Model\\ResourceModel\\Config')->saveConfig($path, 1, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, 0);
         } catch (\Exception $e) {
             $this->messageManager->addError($e->getMessage());
         }
     }
     // clear the block html cache
     $this->_cacheTypeList->cleanType('block_html');
     $this->_eventManager->dispatch('adminhtml_cache_refresh_type', ['type' => 'block_html']);
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setRefererUrl();
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:23,代码来源:IgnoreTaxNotification.php

示例7: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->logger->log('Installing Tablerate:');
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('core_write');
     $fixtureFile = 'OfflineShipping/tablerate.csv';
     $fixtureFilePath = $this->fixtureHelper->getPath($fixtureFile);
     $regions = $this->loadDirectoryRegions();
     /** @var \Magento\SampleData\Helper\Csv\Reader $csvReader */
     $csvReader = $this->csvReaderFactory->create(['fileName' => $fixtureFilePath, 'mode' => 'r']);
     foreach ($csvReader as $data) {
         $regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
         $adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsiteId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
         $this->logger->logInline('.');
     }
     $this->configWriter->save('carriers/tablerate/active', 1);
     $this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
     $this->cacheTypeList->cleanType('config');
 }
开发者ID:ktplKunj,项目名称:TestMagento,代码行数:22,代码来源:Tablerate.php

示例8: clean

 /**
  * Cleans up caches
  *
  * @param array $types
  * @return void
  */
 public function clean(array $types)
 {
     foreach ($types as $type) {
         $this->cacheTypeList->cleanType($type);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Manager.php


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