function _field_sql_storage_query_join_entity

_field_sql_storage_query_join_entity(SelectQuery $select_query, $entity_type, $field_base_table)

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.

File

modules/field/modules/field_sql_storage/field_sql_storage.module, line 670
Default implementation of the field storage API.

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!modules!field_sql_storage!field_sql_storage.module/function/_field_sql_storage_query_join_entity/7.x