GetResponseForControllerResultEvent

class GetResponseForControllerResultEvent extends GetResponseEvent

Allows to create a response for the return value of a controller.

Call setResponse() to set the response that will be returned for the current request. The propagation of this event is stopped as soon as a response is set.

Methods

Response getResponse()

Returns the response object.

from GetResponseEvent
setResponse(Response $response)

Sets a response and stops event propagation.

from GetResponseEvent
bool hasResponse()

Returns whether a response was set.

from GetResponseEvent
__construct(HttpKernelInterface $kernel, Request $request, int $requestType, $controllerResult)
mixed getControllerResult()

Returns the return value of the controller.

setControllerResult(mixed $controllerResult)

Assigns the return value of the controller.

Details

Response getResponse()

Returns the response object.

Return Value

Response

setResponse(Response $response)

Sets a response and stops event propagation.

Parameters

Response $response

bool hasResponse()

Returns whether a response was set.

Return Value

bool Whether a response was set

__construct(HttpKernelInterface $kernel, Request $request, int $requestType, $controllerResult)

Parameters

HttpKernelInterface $kernel
Request $request
int $requestType
$controllerResult

mixed getControllerResult()

Returns the return value of the controller.

Return Value

mixed The controller return value

setControllerResult(mixed $controllerResult)

Assigns the return value of the controller.

Parameters

mixed $controllerResult The controller return value