services_resource_build_index_query

  1. services
    1. 7.3
    2. 6.3
Versions
6.3 services_resource_build_index_query($schema, $order, $page, $fields, $service_params = array(), $primary_table, $primary_field, $page_size, $resource)
7.3 services_resource_build_index_query($query, $page, $fields, $parameters, $page_size, $resource)

Helper function to build index queries.

Parameters

$query Object database query object.

$page Integer page number we are requesting.

$fields Array fields to return.

$parameter Array parameters to add to the index query.

$page_size Integer number of items to be returned.

$resource String name of the resource building the index query

▾ 6 functions call services_resource_build_index_query()

_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.
_user_resource_index in resources/user_resource.inc
Return an array of optionally paged uids baed on a set of criteria.

Code

./services.module, line 488

<?php
function services_resource_build_index_query($query, $page, $fields, $parameters, $page_size, $resource) {
  $default_limit = variable_get("services_{$resource}_index_page_size", 20);
  if (!user_access('perform unlimited index queries') && $page_size > $default_limit) {
    $page_size = $default_limit;
  }
  $query->range($page * $page_size, $page_size);
  if ($fields == '*') {
    $query->fields('t');
  }
  else {
    $query->fields('t', explode(',', $fields));
  }
  if (isset($parameters) && is_array($parameters)) {
    foreach ($parameters as $parameter => $parameter_value) {
      $query->condition($parameter, explode(',', $parameter_value), 'IN');
    }
  }
}
?>