Documentation

ContainerControllerResolver extends ControllerResolver
in package

A controller resolver searching for a controller in a psr-11 container when using the "service:method" notation.

Tags
author

Fabien Potencier fabien@symfony.com

author

Maxime Steinhausser maxime.steinhausser@gmail.com

Table of Contents

$container  : mixed
$logger  : mixed
$supportsScalarTypes  : bool
If scalar types exists.
$supportsVariadic  : bool
If the ...$arg functionality is available.
__construct()  : mixed
getArguments()  : array<string|int, mixed>
Returns the arguments to pass to the controller.
getController()  : callable|false
Returns the Controller instance associated with a Request.
createController()  : mixed
Returns a callable for the given controller.
doGetArguments()  : array<string|int, mixed>
instantiateController()  : object
Returns an instantiated controller.
getControllerError()  : mixed
throwExceptionIfControllerWasRemoved()  : mixed
typeMatchesRequestClass()  : bool

Properties

$supportsVariadic

If the ...$arg functionality is available.

private bool $supportsVariadic

Requires at least PHP 5.6.0 or HHVM 3.9.1

Methods

getArguments()

Returns the arguments to pass to the controller.

public getArguments(Request $request, mixed $controller) : array<string|int, mixed>
Parameters
$request : Request
$controller : mixed
Tags
deprecated

This method is deprecated as of 3.1 and will be removed in 4.0. Implement the ArgumentResolverInterface and inject it in the HttpKernel instead.

Return values
array<string|int, mixed>

An array of arguments to pass to the controller

getController()

Returns the Controller instance associated with a Request.

public getController(Request $request) : callable|false
Parameters
$request : Request
Return values
callable|false

A PHP callable representing the Controller, or false if this resolver is not able to determine the controller

createController()

Returns a callable for the given controller.

protected createController(string $controller) : mixed
Parameters
$controller : string

A Controller string

Tags
throws
LogicException

When the name could not be parsed

throws
InvalidArgumentException

When the controller class does not exist

Return values
mixed

A PHP callable

doGetArguments()

protected doGetArguments(Request $request, callable $controller, array<string|int, ReflectionParameter$parameters) : array<string|int, mixed>
Parameters
$request : Request
$controller : callable
$parameters : array<string|int, ReflectionParameter>
Tags
deprecated

This method is deprecated as of 3.1 and will be removed in 4.0. Implement the ArgumentResolverInterface and inject it in the HttpKernel instead.

Return values
array<string|int, mixed>

The arguments to use when calling the action

instantiateController()

Returns an instantiated controller.

protected instantiateController(mixed $class) : object
Parameters
$class : mixed

A class name

Return values
object

getControllerError()

private getControllerError(mixed $callable) : mixed
Parameters
$callable : mixed
Return values
mixed

throwExceptionIfControllerWasRemoved()

private throwExceptionIfControllerWasRemoved(string $controller[, Exception|Throwable|null $previous = null ]) : mixed
Parameters
$controller : string
$previous : Exception|Throwable|null = null
Return values
mixed

typeMatchesRequestClass()

private typeMatchesRequestClass(ReflectionParameter $param, Request $request) : bool
Parameters
$param : ReflectionParameter
$request : Request
Return values
bool

Search results