You are here

protected function RestfulExampleNodeUserResource::getQuery in RESTful 7

Overrides \RestfulDataProviderDbQuery::getQuery().

Join with the terms table.

Overrides RestfulDataProviderDbQuery::getQuery

File

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

Class

RestfulExampleNodeUserResource
@file Contains RestfulExampleNodeUserResource.

Code

protected function getQuery() {
  $query = parent::getQuery();

  // Add a node access tag.
  $query
    ->addTag('node_access');
  $query
    ->innerJoin('users', 'user', 'node.uid = user.uid');

  // Explicitly set the alias of the column, so it will match the public field
  // name.
  $query
    ->addField('user', 'name', 'name');
  return $query;
}