When importing a field collection where the Identifier Field is a Entity Reference Field, you the following warning:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_name0.field_name_value' in 'where clause'

where field_data_field_name is the table from the field and field_name_value the expented field where the field value resides.

But when the field is a Entity Reference, the field value resides in field_name_target_id.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tucho created an issue. See original summary.

tucho’s picture

Status: Active » Needs review
FileSize
1.44 KB

I attach a patch for this issue.

Now the field type is checked on the entitySave method the field type, and the EntityFieldQuery points to the right field.

SocialNicheGuru’s picture

This seems to work for me.

tucho’s picture

There was an error on the first patch. It throws a warning when the entity does not exists.

I attach a new one, with this problem fixed.

wak’s picture

Thanks for the patch so far!
Would it be possible to include Taxonomy Terms, too? They need 'tid' instead of 'target-id' or 'value' and do not work with the patch therefore.
There might be even more cases not handled yet, like files oder users.