You are here

function services_resource_build_index_list in Services 6.3

Same name and namespace in other branches
  1. 7.3 services.module \services_resource_build_index_list()

Helper function to build a list of items satisfying the index query.

Parameters

$results: Object database query results object.

$type: String type of index that is being processed.

$field: String field to use for looking up uri.

6 calls to services_resource_build_index_list()
_comment_resource_index in resources/comment_resource.inc
Return an array of optionally paged cids baed on a set of criteria.
_file_resource_index in resources/file_resource.inc
Return an array of optionally paged fids baed on a set of criteria.
_node_resource_index in resources/node_resource.inc
Return an array of optionally paged nids baed on a set of criteria.
_taxonomy_term_resource_index in resources/taxonomy_resource.inc
Return an array of optionally paged tids baed on a set of criteria.
_taxonomy_vocabulary_resource_index in resources/taxonomy_resource.inc
Return an array of optionally paged vids baed on a set of criteria.

... See full list

File

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

Code

function services_resource_build_index_list($results, $type, $field) {

  // Put together array of matching items to return.
  $items = array();
  foreach ($results as $result) {
    if ($uri = services_resource_uri(array(
      $type,
      $result->{$field},
    ))) {
      $result->uri = $uri;
      if ($type == 'user') {
        services_remove_user_data($result);
      }
    }
    $items[] = $result;
  }
  return $items;
}