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

ResponseInterface
dispatch(ActionRequest $request)

Dispatches a request to a controller

ResponseInterface
initiateDispatchLoop(ActionRequest $request)

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

void
emitBeforeControllerInvocation(ActionRequest $request, ControllerInterface $controller)

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

void
emitAfterControllerInvocation(ActionRequest $request, ResponseInterface|null $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

ResponseInterface dispatch(ActionRequest $request)

Dispatches a request to a controller

protected ResponseInterface initiateDispatchLoop(ActionRequest $request)

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

Parameters

ActionRequest $request

Return Value

ResponseInterface

Exceptions

NoSuchOptionException

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

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

Parameters

ActionRequest $request
ControllerInterface $controller

Return Value

void

protected void emitAfterControllerInvocation(ActionRequest $request, ResponseInterface|null $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
ResponseInterface|null $response

The readonly response the controller returned or null, if it was just forwarding a request.

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

InvalidControllerException