ControllerResolver
class ControllerResolver extends ControllerResolver implements ControllerResolverInterface (View source)
ControllerResolver to enhance controllers beyond Symfony's basic handling.
It adds two behaviors:
-
When creating a new object-based controller that implements ContainerAwareInterface, inject the container into it. While not always necessary, that allows a controller to vary the services it needs at runtime.
-
By default, a controller name follows the class::method notation. This class adds the possibility to use a service from the container as a controller by using a service:method notation (Symfony uses the same convention).
Properties
| protected ClassResolverInterface | $classResolver | The class resolver. |
|
| protected HttpMessageFactoryInterface | $httpMessageFactory | The PSR-7 converter. |
Methods
Constructs a new ControllerResolver.
Returns the Controller instance with a given controller route definition.
{@inheritdoc}
Returns a callable for the given controller.
Details
__construct(HttpMessageFactoryInterface $http_message_factory, ClassResolverInterface $class_resolver)
Constructs a new ControllerResolver.
mixed|bool
getControllerFromDefinition(mixed $controller, $path = '')
Returns the Controller instance with a given controller route definition.
As several resolvers can exist for a single application, a resolver must return false when it is not able to determine the controller.
getController(Request $request)
{@inheritdoc}
protected mixed
createController(string $controller)
Returns a callable for the given controller.