The dispatcher will try to dispatch the request again if it has not been
addressed yet.
public isDispatched ( ) : boolean | ||
return | boolean | TRUE if this request has been dispatched successfully |
/** * Try processing the request until it is successfully marked "dispatched" * * @param RequestInterface $request * @param ResponseInterface $response * @throws InvalidControllerException|InfiniteLoopException|NoSuchOptionException */ 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(); } } } }