W3cubDocs

/Drupal 8

class 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

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Controller!ControllerResolver.php/class/ControllerResolver/8.1.x