You are here

function services_controllers_list in Services 7.3

Same name and namespace in other branches
  1. 6.3 services.module \services_controllers_list()

Returns all the controller names for a endpoint.

Parameters

string $endpoint: The endpoint that should be used.

Return value

array An array containing all controller names.

File

./services.module, line 637
Provides a generic but powerful API for web services.

Code

function services_controllers_list($endpoint) {
  $controllers = array();
  $class_info = services_operation_class_info();
  $resources = services_get_resources($endpoint);
  foreach ($resources as $resource_name => $resource) {
    foreach ($class_info as $class_name => $class) {
      if (empty($resource[$class_name])) {
        continue;
      }
      foreach ($resource[$class_name] as $op_name => $op) {
        $method = "{$resource_name}.{$op_name}";
        if (empty($controllers[$method])) {
          $controllers[$method] = $method;
        }
        else {
          watchdog('services', 'Naming collision when listing controllers as methods. The %class %operation is not included in the listing.', array(
            '%class' => $class['name'],
            '%operation' => $op_name,
          ), WATCHDOG_WARNING);
        }
      }
    }
  }
  return $controllers;
}