ControllerResolver

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).

Hierarchy

  • class \Symfony\Component\HttpKernel\Controller\ControllerResolver implements \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface

File

core/lib/Drupal/Core/Controller/ControllerResolver.php, line 28

Namespace

Drupal\Core\Controller

Members

Name Modifiers Type Description
ControllerResolver::$classResolver protected property The class resolver.
ControllerResolver::$httpMessageFactory protected property The PSR-7 converter.
ControllerResolver::$logger private property
ControllerResolver::createController protected function Returns a callable for the given controller. Overrides ControllerResolver::createController
ControllerResolver::doGetArguments protected function Overrides ControllerResolver::doGetArguments
ControllerResolver::getArguments public function Returns the arguments to pass to the controller. Overrides ControllerResolverInterface::getArguments
ControllerResolver::getController public function This method looks for a '_controller' request attribute that represents the controller name (a string like ClassName::MethodName). Overrides ControllerResolver::getController
ControllerResolver::getControllerFromDefinition public function Returns the Controller instance with a given controller route definition. Overrides ControllerResolverInterface::getControllerFromDefinition
ControllerResolver::instantiateController protected function Returns an instantiated controller.
ControllerResolver::__construct public function Constructs a new ControllerResolver. Overrides ControllerResolver::__construct
doc_Drupal
2016-10-29 08:58:58
Comments
Leave a Comment

Please login to continue.