You are here

protected function RESTServer::getController in Services 7.3

Controller is part of the resource like

array( 'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/node_resource'), 'callback' => '_node_resource_create', 'args' => array( array( 'name' => 'node', 'optional' => FALSE, 'source' => 'data', 'description' => 'The node data to create', 'type' => 'array', ), ), 'access callback' => '_node_resource_access', 'access arguments' => array('create'), 'access arguments append' => TRUE, ),

This method determines what is the controller responsible for processing of the request.

Return value

array

1 call to RESTServer::getController()
RESTServer::handle in servers/rest_server/includes/RESTServer.inc
Handles the call to the REST server

File

servers/rest_server/includes/RESTServer.inc, line 87
Class for handling REST calls.

Class

RESTServer
@file Class for handling REST calls.

Code

protected function getController() {
  if (empty($this->controller)) {
    $resource_name = $this
      ->getResourceName();
    if (empty($resource_name) || !isset($this->resources[$resource_name])) {
      return services_error(t('Could not find resource @name.', array(
        '@name' => $resource_name,
      )), 404);
    }
    $resource = $this->resources[$resource_name];
    $this->controller = $this
      ->resolveControllerApplyVersion($resource, $resource_name);
    if (empty($this->controller)) {
      return services_error(t('Could not find the controller.'), 404);
    }
  }
  return $this->controller;
}