/** * 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; }
public function testGetIfFlagWithControllerKryNotExist() { $this->_requestMock->expects($this->never())->method('getActionName'); $this->_requestMock->expects($this->once())->method('getRequestedRouteName')->will($this->returnValue('route')); $this->_requestMock->expects($this->once())->method('getRequestedControllerName')->will($this->returnValue('controller')); $this->assertEquals(false, $this->_actionFlag->get('action', 'flag')); }
/** * {@inheritdoc} */ protected function render(App\ResponseInterface $response) { $this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED)); return parent::render($response); }
/** * Set redirect into response * * @param string $path * @param array $arguments * @return \Magento\Framework\App\ResponseInterface * @TODO move method */ protected function _redirect($path, $arguments = []) { $this->_session->setIsUrlNotice($this->_flag->get('', \Magento\Backend\App\AbstractAction::FLAG_IS_URLS_CHECKED)); $this->_response->setRedirect($this->_helper->getUrl($path, $arguments)); return $this->_response; }
/** * @param string $action * @return $this */ public function forward($action) { $this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED)); return parent::forward($action); }