ViewEvent
extends RequestEvent
in package
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.
Tags
Table of Contents
- $controllerResult : mixed
- The return value of the controller.
- $kernel : mixed
- $propagationStopped : mixed
- $request : mixed
- $requestType : mixed
- $response : mixed
- __construct() : mixed
- getControllerResult() : mixed
- Returns the return value of the controller.
- getKernel() : HttpKernelInterface
- Returns the kernel in which this event was thrown.
- getRequest() : Request
- Returns the request the kernel is currently processing.
- getRequestType() : int
- Returns the request type the kernel is currently processing.
- getResponse() : Response|null
- Returns the response object.
- hasResponse() : bool
- Returns whether a response was set.
- isMainRequest() : bool
- Checks if this is the main request.
- isMasterRequest() : bool
- Checks if this is a master request.
- isPropagationStopped() : bool
- Is propagation stopped?
- setControllerResult() : void
- Assigns the return value of the controller.
- setResponse() : mixed
- Sets a response and stops event propagation.
- stopPropagation() : void
- Stops the propagation of the event to further event listeners.
Properties
$controllerResult
The return value of the controller.
private
mixed
$controllerResult
$kernel
private
mixed
$kernel
$propagationStopped
private
mixed
$propagationStopped
= false
$request
private
mixed
$request
$requestType
private
mixed
$requestType
$response
private
mixed
$response
Methods
__construct()
public
__construct(HttpKernelInterface $kernel, Request $request, int $requestType, mixed $controllerResult) : mixed
Parameters
- $kernel : HttpKernelInterface
- $request : Request
- $requestType : int
- $controllerResult : mixed
Return values
mixed —getControllerResult()
Returns the return value of the controller.
public
getControllerResult() : mixed
Return values
mixed —getKernel()
Returns the kernel in which this event was thrown.
public
getKernel() : HttpKernelInterface
Return values
HttpKernelInterface —getRequest()
Returns the request the kernel is currently processing.
public
getRequest() : Request
Return values
Request —getRequestType()
Returns the request type the kernel is currently processing.
public
getRequestType() : int
Return values
int —One of HttpKernelInterface::MAIN_REQUEST and HttpKernelInterface::SUB_REQUEST
getResponse()
Returns the response object.
public
getResponse() : Response|null
Return values
Response|null —hasResponse()
Returns whether a response was set.
public
hasResponse() : bool
Return values
bool —isMainRequest()
Checks if this is the main request.
public
isMainRequest() : bool
Return values
bool —isMasterRequest()
Checks if this is a master request.
public
isMasterRequest() : bool
Tags
Return values
bool —isPropagationStopped()
Is propagation stopped?
public
isPropagationStopped() : bool
Return values
bool —setControllerResult()
Assigns the return value of the controller.
public
setControllerResult(mixed $controllerResult) : void
Parameters
- $controllerResult : mixed
-
The controller return value
Return values
void —setResponse()
Sets a response and stops event propagation.
public
setResponse(Response $response) : mixed
Parameters
- $response : Response
Return values
mixed —stopPropagation()
Stops the propagation of the event to further event listeners.
public
stopPropagation() : void
If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().