You are here

public function RestfulExampleNodeUserResource::publicFieldsInfo in RESTful 7

Return the properties that should be public.

Return value

array

Throws

\RestfulEntityViewMode

Overrides RestfulInterface::publicFieldsInfo

File

modules/restful_example/plugins/restful/db_query/node_user/1.0/RestfulExampleNodeUserResource.class.php, line 13
Contains RestfulExampleNodeUserResource.

Class

RestfulExampleNodeUserResource
@file Contains RestfulExampleNodeUserResource.

Code

public function publicFieldsInfo() {
  $public_fields['id'] = array(
    'property' => 'nid',
  );
  $public_fields['label'] = array(
    'property' => 'title',
  );

  // The terms are taken from a join query, as they exist on another table.
  $public_fields['author'] = array(
    'property' => 'name',
    // Set the actual column name, so WHERE and ORDER BY may work, as MySql
    // doesn't allow using a column alias for those operations.
    'column_for_query' => 'user.name',
  );
  return $public_fields;
}