class Dispatcher (View source)

Dispatches requests to the controller which was specified by the request and returns the response the controller generated.

Properties

protected ObjectManagerInterface $objectManager
protected Context $securityContext
protected FirewallInterface $firewall

Methods

void
injectObjectManager(ObjectManagerInterface $objectManager)

Inject the Object Manager through setter injection because property injection is not available during compile time.

injectSecurityContext(Context $context)

No description

injectFirewall(FirewallInterface $firewall)

No description

void
dispatch(ActionRequest $request, ActionResponse $response)

Dispatches a request to a controller

initiateDispatchLoop(ActionRequest $request, ActionResponse $parentResponse)

Try processing the request until it is successfully marked "dispatched"

void
emitBeforeControllerInvocation(ActionRequest $request, ActionResponse $response, ControllerInterface $controller)

This signal is emitted directly before the request is been dispatched to a controller.

void
emitAfterControllerInvocation(ActionRequest $request, ActionResponse $response, ControllerInterface $controller)

This signal is emitted directly after the request has been dispatched to a controller and the controller returned control back to the dispatcher.

resolveController(ActionRequest $request)

Finds and instantiates a controller that matches the current request.

Details

void injectObjectManager(ObjectManagerInterface $objectManager)

Inject the Object Manager through setter injection because property injection is not available during compile time.

Parameters

ObjectManagerInterface $objectManager

Return Value

void

injectSecurityContext(Context $context)

No description

Parameters

Context $context

injectFirewall(FirewallInterface $firewall)

No description

Parameters

FirewallInterface $firewall

void dispatch(ActionRequest $request, ActionResponse $response)

Dispatches a request to a controller

Parameters

ActionRequest $request

The request to dispatch

ActionResponse $response

The response, to be modified by the controller

Return Value

void

Exceptions

AccessDeniedException
AuthenticationRequiredException
InfiniteLoopException
InvalidControllerException
NoSuchOptionException
MissingConfigurationException

protected ActionResponse initiateDispatchLoop(ActionRequest $request, ActionResponse $parentResponse)

Try processing the request until it is successfully marked "dispatched"

Parameters

ActionRequest $request
ActionResponse $parentResponse

Return Value

ActionResponse

Exceptions

UnsupportedRequestTypeException

protected void emitBeforeControllerInvocation(ActionRequest $request, ActionResponse $response, ControllerInterface $controller)

This signal is emitted directly before the request is been dispatched to a controller.

Parameters

ActionRequest $request
ActionResponse $response
ControllerInterface $controller

Return Value

void

protected void emitAfterControllerInvocation(ActionRequest $request, ActionResponse $response, ControllerInterface $controller)

This signal is emitted directly after the request has been dispatched to a controller and the controller returned control back to the dispatcher.

Parameters

ActionRequest $request
ActionResponse $response
ControllerInterface $controller

Return Value

void

protected ControllerInterface resolveController(ActionRequest $request)

Finds and instantiates a controller that matches the current request.

If no controller can be found, an instance of NotFoundControllerInterface is returned.

Parameters

ActionRequest $request

The request to dispatch

Return Value

ControllerInterface

Exceptions

NoSuchOptionException
InvalidControllerException