Returns an entity controller class.
string $entity_type: The name of the entity type
string $controller_type: The name of the controller.
string|null $nested: (optional) If this controller definition is nested, the name of the key. Defaults to NULL.
string The class name for this controller instance.
public function getControllerClass($entity_type, $controller_type, $nested = NULL) {
$definition = $this
->getDefinition($entity_type);
$definition = $definition['controllers'];
if (empty($definition[$controller_type])) {
throw new \InvalidArgumentException(sprintf('The entity (%s) did not specify a %s.', $entity_type, $controller_type));
}
$class = $definition[$controller_type];
// Some class definitions can be nested.
if (isset($nested)) {
if (empty($class[$nested])) {
throw new \InvalidArgumentException(sprintf("Missing '%s: %s' for entity '%s'", $controller_type, $nested, $entity_type));
}
$class = $class[$nested];
}
if (!class_exists($class)) {
throw new \InvalidArgumentException(sprintf('Entity (%s) %s "%s" does not exist.', $entity_type, $controller_type, $class));
}
return $class;
}