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


PHP SessionManagerInterface::setData方法代码示例

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


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

示例1: testDestroy

 public function testDestroy()
 {
     $data = array('key' => 'value');
     $this->_model->setData($data);
     $this->assertEquals($data, $this->_model->getData());
     $this->_model->destroy();
     $this->assertEquals(array(), $this->_model->getData());
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:8,代码来源:SessionManagerTest.php

示例2: afterGenerateXml

 /**
  * After generate Xml
  *
  * @param \Magento\Framework\View\LayoutInterface $subject
  * @param \Magento\Framework\View\LayoutInterface $result
  * @return \Magento\Framework\View\LayoutInterface
  */
 public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
 {
     if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
         $this->visitor->setSkipRequestLogging(true);
         $this->visitor->unsetData();
         $this->session->clearStorage();
         $this->customerSession->clearStorage();
         $this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey);
         $this->customerSession->setCustomerGroupId($this->customerGroupId);
         $this->customerSession->setCustomer($this->customerFactory->create()->setGroupId($this->customerGroupId));
     }
     return $result;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:DepersonalizePlugin.php

示例3: afterGenerateXml

 /**
  * After generate Xml
  *
  * @param \Magento\Framework\View\LayoutInterface $subject
  * @param \Magento\Framework\View\LayoutInterface $result
  * @return \Magento\Framework\View\LayoutInterface
  */
 public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
         $this->visitor->setSkipRequestLogging(true);
         $this->visitor->unsetData();
         $this->session->clearStorage();
         $this->customerSession->clearStorage();
         $this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey);
         $this->customerSession->setCustomerGroupId($this->customerGroupId);
         $this->customer->setGroupId($this->customerGroupId);
         $this->customerSession->setCustomer($this->customer);
     }
     return $result;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:DepersonalizePlugin.php

示例4: _setWord

 /**
  * Set captcha word
  *
  * @param  string $word
  * @return $this
  */
 protected function _setWord($word)
 {
     $this->_session->setData($this->_getFormIdKey(self::SESSION_WORD), ['data' => $word, 'expires' => time() + $this->getTimeout()]);
     $this->_word = $word;
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:DefaultModel.php

示例5: set

 /**
  * @param string $value
  * @return void
  */
 public function set($value)
 {
     $this->session->setData(self::FORM_KEY, $value);
 }
开发者ID:vv-team,项目名称:foodo,代码行数:8,代码来源:FormKey.php

示例6: _partialAuthorization

 /**
  * Send request with new payment to gateway during partial authorization process
  *
  * @param \Magento\Payment\Model\Info $payment
  * @param float $amount
  * @param string $requestType
  * @return $this
  * @throws \Magento\Payment\Model\Info\Exception
  * @throws \Magento\Framework\Model\Exception
  */
 protected function _partialAuthorization($payment, $amount, $requestType)
 {
     $payment->setAnetTransType($requestType);
     /*
      * Try to build checksum of first request and compare with current checksum
      */
     if ($this->getConfigData('partial_authorization_checksum_checking')) {
         $payment->setAmount($amount);
         $firstPlacingRequest = $this->_buildRequest($payment);
         $newChecksum = $this->_generateChecksum($firstPlacingRequest, $this->_partialAuthorizationChecksumDataKeys);
         $previosChecksum = $this->_session->getData($this->_partialAuthorizationChecksumSessionKey);
         if ($newChecksum != $previosChecksum) {
             $quotePayment = $payment->getOrder()->getQuote()->getPayment();
             $this->cancelPartialAuthorization($payment);
             $this->_clearAssignedData($quotePayment);
             $this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_DATA_CHANGED);
             $quotePayment->setAdditionalInformation($payment->getAdditionalInformation());
             throw new \Magento\Payment\Model\Info\Exception(__('The shopping cart contents and/or address has been changed.'));
         }
     }
     $amount = $amount - $this->getCardsStorage()->getProcessedAmount();
     if ($amount <= 0) {
         throw new \Magento\Framework\Model\Exception(__('This is an invalid amount for partial authorization.'));
     }
     $payment->setAmount($amount);
     $request = $this->_buildRequest($payment);
     $result = $this->_postRequest($request);
     $this->_processPartialAuthorizationResponse($result, $payment);
     switch ($requestType) {
         case self::REQUEST_TYPE_AUTH_ONLY:
             $newTransactionType = \Magento\Sales\Model\Order\Payment\Transaction::TYPE_AUTH;
             break;
         case self::REQUEST_TYPE_AUTH_CAPTURE:
             $newTransactionType = \Magento\Sales\Model\Order\Payment\Transaction::TYPE_CAPTURE;
             break;
     }
     foreach ($this->getCardsStorage()->getCards() as $card) {
         $this->_addTransaction($payment, $card->getLastTransId(), $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId()), $this->_authorizenetData->getTransactionMessage($payment, $requestType, $card->getLastTransId(), $card, $card->getProcessedAmount()));
         if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
             $card->setCapturedAmount($card->getProcessedAmount());
             $this->getCardsStorage()->updateCard($card);
         }
     }
     $this->_session->setData($this->_partialAuthorizationChecksumSessionKey, null);
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:56,代码来源:Authorizenet.php

示例7: _resetValidationState

 /**
  * Drop validation state model
  *
  * @return void
  */
 protected function _resetValidationState()
 {
     $this->_centinelSession->setData(array());
     $this->_validationState = false;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Service.php


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