function _field_sql_storage_query_join_entity

Adds the base entity table to a field query object.

Parameters

SelectQuery $select_query: A SelectQuery containing at least one table as specified by _field_sql_storage_tablename().

$entity_type: The entity type for which the base table should be joined.

$field_base_table: Name of a table in $select_query. As only INNER JOINs are used, it does not matter which.

Return value

The name of the entity base table joined in.

2 calls to _field_sql_storage_query_join_entity()
field_sql_storage_field_storage_query in modules/field/modules/field_sql_storage/field_sql_storage.module
Implements hook_field_storage_query().
hook_field_storage_query in modules/field/field.api.php
Execute an EntityFieldQuery.

File

modules/field/modules/field_sql_storage/field_sql_storage.module, line 778

Code

function _field_sql_storage_query_join_entity(SelectQuery $select_query, $entity_type, $field_base_table) {
    $entity_info = entity_get_info($entity_type);
    $entity_base_table = $entity_info['base table'];
    $entity_field = $entity_info['entity keys']['id'];
    $select_query->join($entity_base_table, $entity_base_table, "{$entity_base_table}.{$entity_field} = {$field_base_table}.entity_id");
    return $entity_base_table;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.