ControllerEvent
extends KernelEvent
in package
Allows filtering of a controller callable.
You can call getController() to retrieve the current controller. With setController() you can set a new controller that is used in the processing of the request.
Controllers should be callables.
Tags
Table of Contents
Properties
- $controller : string|array<string|int, mixed>|object
- $kernel : mixed
- $propagationStopped : bool
- $request : mixed
- $requestType : int|null
Methods
- __construct() : mixed
- getController() : callable
- 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.
- isMainRequest() : bool
- Checks if this is the main request.
- isPropagationStopped() : bool
- Is propagation stopped?
- setController() : void
- stopPropagation() : void
- Stops the propagation of the event to further event listeners.
Properties
$controller
private
string|array<string|int, mixed>|object
$controller
$kernel
private
mixed
$kernel
$propagationStopped
private
bool
$propagationStopped
= false
$request
private
mixed
$request
$requestType
private
int|null
$requestType
Methods
__construct()
public
__construct(HttpKernelInterface $kernel, callable $controller, Request $request, int|null $requestType) : mixed
Parameters
- $kernel : HttpKernelInterface
- $controller : callable
- $request : Request
- $requestType : int|null
-
The request type the kernel is currently processing; one of HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST
getController()
public
getController() : callable
Return values
callablegetKernel()
Returns the kernel in which this event was thrown.
public
getKernel() : HttpKernelInterface
Return values
HttpKernelInterfacegetRequest()
Returns the request the kernel is currently processing.
public
getRequest() : Request
Return values
RequestgetRequestType()
Returns the request type the kernel is currently processing.
public
getRequestType() : int
Return values
int —One of HttpKernelInterface::MAIN_REQUEST and HttpKernelInterface::SUB_REQUEST
isMainRequest()
Checks if this is the main request.
public
isMainRequest() : bool
Return values
boolisPropagationStopped()
Is propagation stopped?
public
isPropagationStopped() : bool
Return values
bool —True if the Event is complete and no further listeners should be called. False to continue calling listeners.
setController()
public
setController(callable $controller) : void
Parameters
- $controller : callable
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().