function _comment_resource_index in Services 7.3
Same name and namespace in other branches
- 6.3 resources/comment_resource.inc \_comment_resource_index()
Return an array of optionally paged cids based on a set of criteria.
An example request might look like
http://domain/endpoint/comment?fields=cid,nid¶meters[nid]=7¶mete...
This would return an array of objects with only cid and nid defined, where nid = 7 and uid = 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 comment objects.
See also
_node_resource_index() for more notes
1 string reference to '_comment_resource_index'
- _comment_resource_definition in resources/
comment_resource.inc
File
- resources/
comment_resource.inc, line 340
Code
function _comment_resource_index($page, $fields, $parameters, $page_size, $options = array()) {
$comment_select = db_select('comment', 't');
services_resource_build_index_query($comment_select, $page, $fields, $parameters, $page_size, 'comment', $options);
if (!user_access('administer comments')) {
$comment_select
->condition('status', COMMENT_PUBLISHED);
}
$results = services_resource_execute_index_query($comment_select);
return services_resource_build_index_list($results, 'comment', 'cid');
}