protected function initiateDispatchLoop(RequestInterface $request, ResponseInterface $response)
    {
        $dispatchLoopCount = 0;
        /** @var ActionRequest $request */
        while (!$request->isDispatched()) {
            if ($dispatchLoopCount++ > 99) {
                throw new Exception\InfiniteLoopException(sprintf('Could not ultimately dispatch the request after %d iterations.', $dispatchLoopCount), 1217839467);
            }
            $controller = $this->resolveController($request);
            try {
                $this->emitBeforeControllerInvocation($request, $response, $controller);
                $controller->processRequest($request, $response);
                $this->emitAfterControllerInvocation($request, $response, $controller);
            } catch (StopActionException $exception) {
                $this->emitAfterControllerInvocation($request, $response, $controller);
                if ($exception instanceof ForwardException) {
                    $request = $exception->getNextRequest();
                } elseif (!$request->isMainRequest()) {
                    $request = $request->getParentRequest();
                }
            }
        }
    }
protected function initiateDispatchLoop(RequestInterface $request, ResponseInterface $response)
    {
        $dispatchLoopCount = 0;
        /** @var ActionRequest $request */
        while (!$request->isDispatched()) {
            if ($dispatchLoopCount++ > 99) {
                throw new Exception\InfiniteLoopException(sprintf('Could not ultimately dispatch the request after %d iterations.', $dispatchLoopCount), 1217839467);
            }
            $controller = $this->resolveController($request);
            try {
                $this->emitBeforeControllerInvocation($request, $response, $controller);
                $controller->processRequest($request, $response);
                $this->emitAfterControllerInvocation($request, $response, $controller);
            } catch (StopActionException $exception) {
                $this->emitAfterControllerInvocation($request, $response, $controller);
                if ($exception instanceof ForwardException) {
                    $request = $exception->getNextRequest();
                } elseif (!$request->isMainRequest()) {
                    $request = $request->getParentRequest();
                }
            }
        }
    }
protected function initiateDispatchLoop ( RequestInterface $ request , ResponseInterface $ response ) { $ dispatchLoopCount = 0 ; /** @var ActionRequest $request */ while ( ! $ request -> isDispatched ( ) ) { if ( $ dispatchLoopCount ++ > 99 ) { throw new Exception \ InfiniteLoopException ( sprintf ( 'Could not ultimately dispatch the request after %d iterations.' , $ dispatchLoopCount ) , 1217839467 ) ; } $ controller = $ this -> resolveController ( $ request ) ; try { $ this -> emitBeforeControllerInvocation ( $ request , $ response , $ controller ) ; $ controller -> processRequest ( $ request , $ response ) ; $ this -> emitAfterControllerInvocation ( $ request , $ response , $ controller ) ; } catch ( StopActionException $ exception ) { $ this -> emitAfterControllerInvocation ( $ request , $ response , $ controller ) ; if ( $ exception instanceof ForwardException ) { $ request = $ exception -> getNextRequest ( ) ; } elseif ( ! $ request -> isMainRequest ( ) ) { $ request = $ request -> getParentRequest ( ) ; } } } }
Try processing the request until it is successfully marked "dispatched"

@param RequestInterface $request
@param ResponseInterface $response
@throws InvalidControllerException|InfiniteLoopException|NoSuchOptionException

TODO: From next major we might want to create one ActionResponse PER controller invocation and then merge results here
Try processing the request until it is successfully marked dispatched