I have the following code:
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'field_collection_item', '=')
->propertyCondition('field_name', 'field_version', '=')
->fieldCondition('field_version', 'entity_id', '105', '=')
->execute()
;
The first two conditions are fine, but the fieldCondition() is causing the following SQL exception:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_version0.field_version_entity_id' in 'where clause'...
The problem seems to be that 'field_version' is prepended to the column 'entity_id'. I have looked inside _field_sql_storage_query_field_conditions()
and there appears to be no way to stop it from prepending this. This is the table I am trying to perform the fieldCondition on:
+-------------+---------------+---------+-----------+-------------+----------+-------+---------------------+ | entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_version_value | +-------------+---------------+---------+-----------+-------------+----------+-------+---------------------+ | node | shopping_cart | 0 | 105 | 123 | und | 0 | 5 | | node | shopping_cart | 0 | 108 | 126 | und | 0 | 8 | +-------------+---------------+---------+-----------+-------------+----------+-------+---------------------+
How may I perform this query correctly?