I'm working with the module "services" everything's ok with a get request, note that i've create my own custom resource with CRUD operations, the "retrieve","update" are ok but the problem is with the index operation. With only one field it works and show all records with the default field I declared on resource. Now how to put an array of $fields ?
This is the resource declaration (the "fields" part of the code) :
array(
'name' => 'fields',
'optional' => TRUE,
'type' => 'string',
'description' => 'The fields to get.',
'default value' => 'field_title_value',
'source' => array('param' => 'fields'),
),
now here is the function index (callback) :
function _my_module_livre_index($page, $fields, $parameters, $page_size){
$query = db_select('field_data_field_title','t');
services_resource_build_index_query($query, $page, $fields, $parameters, $page_size, 'Livre');
$result = services_resource_execute_index_query($query);
$bien = services_resource_build_index_list($result, 'livre', 'field_title_value');
return array('code'=>'0', 'response'=>$bien);
}
The doc of services said that $fields is an array of fields i want to return, when i make :
$fields = array('field 1','field 2','field 3');
It return an error. If I make a "classic" :
$query = db_select('my table')
->fields('my table', array('field 1','field 2','field 3')
Same error.
Any help please ?
Thank you all.