diff --git a/core/modules/entity/entity.query.inc b/core/modules/entity/entity.query.inc index b4e91a2..345f194 --- a/core/modules/entity/entity.query.inc +++ b/core/modules/entity/entity.query.inc @@ -810,7 +810,7 @@ class EntityFieldQuery { $id_map['entity_id'] = $sql_field; $select_query->addField($base_table, $sql_field, 'entity_id'); if (isset($this->entityConditions['entity_id'])) { - $this->addCondition($select_query, $sql_field, $this->entityConditions['entity_id']); + $this->addCondition($select_query, "$base_table." . $sql_field, $this->entityConditions['entity_id']); } // If there is a revision key defined, use it. @@ -818,7 +818,7 @@ class EntityFieldQuery { $sql_field = $entity_info['entity keys']['revision']; $select_query->addField($base_table, $sql_field, 'revision_id'); if (isset($this->entityConditions['revision_id'])) { - $this->addCondition($select_query, $sql_field, $this->entityConditions['revision_id']); + $this->addCondition($select_query, "$base_table." . $sql_field, $this->entityConditions['revision_id']); } } else { @@ -843,7 +843,13 @@ class EntityFieldQuery { } $id_map['bundle'] = $sql_field; if (isset($this->entityConditions['bundle'])) { - $this->addCondition($select_query, $sql_field, $this->entityConditions['bundle'], $having); + if (!empty($entity_info['entity keys']['bundle'])) { + $this->addCondition($select_query, "$base_table". $sql_field, $this->entityConditions['bundle'], $having); + } + else { + // This entity has no bundle, invalidate the query. + $select_query->where('1 = 0'); + } } // Order the query.