本文整理汇总了PHP中Magento\Framework\Model\Context::getCacheManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getCacheManager方法的具体用法?PHP Context::getCacheManager怎么用?PHP Context::getCacheManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\Context
的用法示例。
在下文中一共展示了Context::getCacheManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Catalog\Block\Product\Context $pcontext
* @param \Magento\Catalog\Model\Product $productModel
* @param array $data
* @ignore_var product
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Model\Context $contextBis, \Wyomind\Core\Helper\Data $coreHelper, array $data = [])
{
parent::__construct($context, $data);
$this->_coreHelper = $coreHelper;
$this->_cacheManager = $contextBis->getCacheManager();
$this->_session = $context->getSession();
if ($this->getRequest()->getParam("namespace")) {
$namespace = $this->getRequest()->getParam("namespace");
$wgsActivationKey = $this->getRequest()->getParam("wgs_activation_key");
$wgsStatus = $this->getRequest()->getParam("wgs_status");
$wgsVersion = $this->getRequest()->getParam("wgs_version");
$wgsActivation = $this->getRequest()->getParam("wgs_activation");
$wgsMessage = $this->getRequest()->getParam("wgs_message");
$activationKey = $this->_coreHelper->getDefaultConfigUncrypted("{$namespace}/license/activation_key");
$baseUrl = $this->_coreHelper->getDefaultConfig("web/secure/base_url");
$registeredVersion = $this->_coreHelper->getDefaultConfig("{$namespace}/license/version");
} else {
$this->_message = "<div class='message message-error error'>" . __("Invalid data.") . "</div>";
}
if (isset($wgsActivationKey) && $wgsActivationKey == $this->_coreHelper->getStoreConfigUncrypted("{$namespace}/license/activation_key")) {
if (isset($wgsStatus)) {
switch ($wgsStatus) {
case "success":
$this->_coreHelper->setDefaultConfig("{$namespace}/license/version", $wgsVersion);
$this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_flag", 0);
$this->_coreHelper->setDefaultConfigCrypted("{$namespace}/license/activation_code", $wgsActivation);
$this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 0);
$this->_session->setData("update_" . $namespace, "false");
$this->_cacheManager->clean(['config']);
$this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
break;
case "error":
$this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
$this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
$this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_code", "");
$this->_cacheManager->clean(['config']);
break;
case "uninstall":
$this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
$this->setDefaultConfig("{$namespace}/license/activation_key", "");
$this->setDefaultConfig("{$namespace}/license/activation_code", "");
$this->setStoreConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
$this->_cacheManager->clean(['config']);
$this->getResponse()->setBody("\n <form action='http://www.wyomind.com/license_activation/?method=post' id='license_uninstall' method='post'>\n <input type='hidden' type='action' value='uninstall' name='action'>\n <input type='hidden' value='" . $baseUrl . "' name='domain'>\n <input type='hidden' value='" . $activationKey . "' name='activation_key'>\n <input type='hidden' value='" . $registeredVersion . "' name='registered_version'>\n <button type='submit'" . __("If nothing happens click here !") . "</button>\n <script language='javascript'>\n document.getElementById('license_uninstall').submit();\n </script>\n </form>");
break;
default:
$this->_message = __("An error occurs while retrieving the license activation (500)");
$this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_code", "");
$this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
$this->_cacheManager->clean(['config']);
break;
}
} else {
$this->_message = "<div class='message message-error error'>" . __("An error occurs while retrieving license activation (404).") . "</div>";
}
} else {
$this->_message = "<div class='message message-error error'>" . __("Invalid activation key.") . "</div>";
}
}
示例2: __construct
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Model\Context $contextModel
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @param \Wyomind\Core\Helper\Data $coreHelper
* @param \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper
* @param \Wyomind\SimpleGoogleShopping\Model\Feeds $sgsModel
* @param \Magento\Framework\Model\Context $context_
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead
* @param \Wyomind\SimpleGoogleShopping\Helper\Parser $parserHelper
* @param \Magento\Eav\Api\AttributeRepositoryInterface $attributeRepository
*/
public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Model\Context $contextModel, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Wyomind\Core\Helper\Data $coreHelper, \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper, \Wyomind\SimpleGoogleShopping\Model\Feeds $sgsModel, \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead, \Wyomind\SimpleGoogleShopping\Helper\Parser $parserHelper, \Magento\Eav\Api\AttributeRepositoryInterface $attributeRepository)
{
$this->coreRegistry = $coreRegistry;
$this->resultPageFactory = $resultPageFactory;
$this->coreHelper = $coreHelper;
$this->cacheManager = $contextModel->getCacheManager();
$this->sgsHelper = $sgsHelper;
$this->sgsModel = $sgsModel;
$this->resultForwardFactory = $resultForwardFactory;
$this->resultRedirectFactory = $context->getResultRedirectFactory();
$this->resultRawFactory = $resultRawFactory;
$this->parserHelper = $parserHelper;
$this->attributeRepository = $attributeRepository;
$this->directoryRead = $directoryRead->create("app/code/Wyomind/SimpleGoogleShopping");
parent::__construct($context);
}
示例3: __construct
public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\Message\ManagerInterface $messageManager, \Magento\Framework\Stdlib\DateTime\DateTime $coreDate, \Wyomind\Core\Model\ResourceModel\ScheduleFactory $scheduleFactory, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Config\Model\ResourceModel\Config $config, \Magento\Framework\Model\Context $contextBis, \Magento\Framework\Module\ModuleList $moduleList, \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder, \Magento\Framework\App\Filesystem\DirectoryList $directoryList, \Magento\Framework\App\ProductMetadata $productMetaData)
{
parent::__construct($context);
$this->moduleList = $moduleList;
$this->encryptor = $encryptor;
$this->scopeConfig = $context->getScopeConfig();
$this->cacheManager = $contextBis->getCacheManager();
$this->config = $config;
$this->directoryList = $directoryList;
$this->constructor($this, func_get_args());
$this->{$this->x6a->x9ff->{$this->x6a->x9ff->{$this->xcb->x9ff->xad6}}} = $productMetaData->{$this->x6a->x9ff->x14b9}();
$this->{$this->x6a->x9ff->{$this->xcb->x9ff->xa58}} = $messageManager;
$this->{$this->x21->x9ff->{$this->x6a->x9ff->xa5c}} = $coreDate;
$this->{$this->xcb->x9ff->{$this->x21->x9ff->{$this->x21->x9ff->xa71}}} = $scheduleFactory;
$this->{$this->xcb->xa27->x173a} = $resultRawFactory;
$this->{$this->x6a->x9ff->{$this->x21->x9ff->{$this->xcb->x9ff->xa91}}} = $encryptor;
$this->{$this->x6a->xa27->x1760} = $contextBis;
$this->{$this->x21->x9ff->{$this->x6a->x9ff->xaad}} = $moduleList;
$this->{$this->xcb->x9ff->{$this->x21->x9ff->xab5}} = $transportBuilder;
}
示例4: __construct
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\Db $resourceCollection
* @param array $data
*/
public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [])
{
$this->_registry = $registry;
$this->_appState = $context->getAppState();
$this->_eventManager = $context->getEventDispatcher();
$this->_cacheManager = $context->getCacheManager();
$this->_resource = $resource;
$this->_resourceCollection = $resourceCollection;
$this->_logger = $context->getLogger();
$this->_actionValidator = $context->getActionValidator();
if (method_exists($this->_resource, 'getIdFieldName') || $this->_resource instanceof \Magento\Framework\Object) {
$this->_idFieldName = $this->_getResource()->getIdFieldName();
}
parent::__construct($data);
$this->_construct();
}