You are here

function _taxonomy_term_resource_index in Services 7.3

Same name and namespace in other branches
  1. 6.3 resources/taxonomy_resource.inc \_taxonomy_term_resource_index()

Return an array of optionally paged tids based on a set of criteria.

An example request might look like

http://domain/endpoint/taxonomy_term?fields=tid,name&parameters[tid]=7&p...

This would return an array of objects with only tid and name defined, where tid = 7 and vid = 1.

Parameters

$page: Page number of results to return (in pages of 20).

$fields: The fields you want returned.

$parameters: An array containing fields and values used to build a sql WHERE clause indicating items to retrieve.

$page_size: Integer number of items to be returned.

$options: Additional query options.

Return value

An array of term objects.

See also

_node_resource_index() for more notes

1 string reference to '_taxonomy_term_resource_index'
_taxonomy_resource_definition in resources/taxonomy_resource.inc
@file Link general taxonomy functionalities to services module.

File

resources/taxonomy_resource.inc, line 655
Link general taxonomy functionalities to services module.

Code

function _taxonomy_term_resource_index($page, $fields, $parameters, $page_size, $options = array()) {
  $taxonomy_select = db_select('taxonomy_term_data', 't');
  $taxonomy_select
    ->addTag('taxonomy_term_access');
  $taxonomy_select
    ->join('taxonomy_term_hierarchy', 'tth', 't.tid = tth.tid');
  $taxonomy_select
    ->fields('tth');
  services_resource_build_index_query($taxonomy_select, $page, $fields, $parameters, $page_size, 'taxonomy_term', $options);
  $results = services_resource_execute_index_query($taxonomy_select);
  return services_resource_build_index_list($results, 'taxonomy_term', 'tid');
}