1 field_sql_storage.module _field_sql_storage_query_field_conditions(EntityFieldQuery $query, SelectQuery $select_query, $conditions, $table_aliases, $column_callback)

Adds field (meta) conditions to the given query objects respecting groupings.


EntityFieldQuery $query: The field query object to be processed.

SelectQuery $select_query: The SelectQuery that should get grouping conditions.

conditions: The conditions to be added.

$table_aliases: An associative array of table aliases keyed by field index.

$column_callback: A callback that should return the column name to be used for the field conditions. Accepts a field name and a field column name as parameters.


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


function _field_sql_storage_query_field_conditions(EntityFieldQuery $query, SelectQuery $select_query, $conditions, $table_aliases, $column_callback) {
  $groups = &backdrop_static(__FUNCTION__, array());
  foreach ($conditions as $key => $condition) {
    $table_alias = $table_aliases[$key];
    $field = $condition['field'];
    // Add the specified condition.
    $sql_field = "$table_alias." . $column_callback($field['field_name'], $condition['column']);
    $query->addCondition($select_query, $sql_field, $condition);
    // Add delta / language group conditions.
    foreach (array('delta', 'language') as $column) {
      if (isset($condition[$column . '_group'])) {
        $group_name = $condition[$column . '_group'];
        if (!isset($groups[$column][$group_name])) {
          $groups[$column][$group_name] = $table_alias;
        else {
          $select_query->where("$table_alias.$column = " . $groups[$column][$group_name] . ".$column");