function _field_sql_storage_tablealias
_field_sql_storage_tablealias($tablename, $field_key, EntityFieldQuery $query)
Generates a table alias for a field data table.
The table alias is unique for each unique combination of field name (represented by $tablename), delta_group and language_group.
Parameters
$tablename: The name of the data table for this field.
$field_key: The numeric key of this field in this query.
$query: The EntityFieldQuery that is executed.
Return value
A string containing the generated table alias.
File
- modules/field/modules/field_sql_storage/field_sql_storage.module, line 83
- Default implementation of the field storage API.
Code
function _field_sql_storage_tablealias($tablename, $field_key, EntityFieldQuery $query) { // No conditions present: use a unique alias. if (empty($query->fieldConditions[$field_key])) { return $tablename . $field_key; } // Find the delta and language condition values and append them to the alias. $condition = $query->fieldConditions[$field_key]; $alias = $tablename; $has_group_conditions = FALSE; foreach (array('delta', 'language') as $column) { if (isset($condition[$column . '_group'])) { $alias .= '_' . $column . '_' . $condition[$column . '_group']; $has_group_conditions = TRUE; } } // Return the alias when it has delta/language group conditions. if ($has_group_conditions) { return $alias; } // Return a unique alias in other cases. return $tablename . $field_key; }
© 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_tablealias/7.x