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


PHP RequestInterface::isDispatched方法代碼示例

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


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

示例1: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return ResponseInterface
  * @throws NotFoundException
  */
 public function dispatch(RequestInterface $request)
 {
     $this->_request = $request;
     $profilerKey = 'CONTROLLER_ACTION:' . $request->getFullActionName();
     $eventParameters = ['controller_action' => $this, 'request' => $request];
     $this->_eventManager->dispatch('controller_action_predispatch', $eventParameters);
     $this->_eventManager->dispatch('controller_action_predispatch_' . $request->getRouteName(), $eventParameters);
     $this->_eventManager->dispatch('controller_action_predispatch_' . $request->getFullActionName(), $eventParameters);
     \Magento\Framework\Profiler::start($profilerKey);
     $result = null;
     if ($request->isDispatched() && !$this->_actionFlag->get('', self::FLAG_NO_DISPATCH)) {
         \Magento\Framework\Profiler::start('action_body');
         $result = $this->execute();
         \Magento\Framework\Profiler::start('postdispatch');
         if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) {
             $this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getFullActionName(), $eventParameters);
             $this->_eventManager->dispatch('controller_action_postdispatch_' . $request->getRouteName(), $eventParameters);
             $this->_eventManager->dispatch('controller_action_postdispatch', $eventParameters);
         }
         \Magento\Framework\Profiler::stop('postdispatch');
         \Magento\Framework\Profiler::stop('action_body');
     }
     \Magento\Framework\Profiler::stop($profilerKey);
     return $result ?: $this->_response;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:32,代碼來源:Action.php

示例2: dispatch

 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$this->_getSession()->authenticate($this)) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::dispatch($request);
 }
開發者ID:Coplex,項目名稱:magento2,代碼行數:16,代碼來源:Agreement.php

示例3: dispatch

 /**
  * Make sure customer is logged in and put it into registry
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$this->_customerSession->authenticate($this)) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     $customer = $this->_customerSession->getCustomer();
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer);
     $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId());
     return parent::dispatch($request);
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:19,代碼來源:RecurringPayment.php

示例4: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     $allowGuest = $this->_objectManager->get('Magento\\Review\\Helper\\Data')->getIsGuestAllowToWrite();
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$allowGuest && $request->getActionName() == 'post' && $request->isPost()) {
         if (!$this->_customerSession->isLoggedIn()) {
             $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
             $this->_customerSession->setBeforeAuthUrl($this->_url->getUrl('*/*/*', ['_current' => true]));
             $this->_reviewSession->setFormData($request->getPostValue())->setRedirectUrl($this->_redirect->getRefererUrl());
             $this->getResponse()->setRedirect($this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl());
         }
     }
     return parent::dispatch($request);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:22,代碼來源:Product.php


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