Hey,

I found this problem.

I have a field collection item that has a taxonomy, a date and a text field.

When using the class I do the following

  $efq->entityCondition('entity_type', 'field_collection_item')
              ->entityCondition('bundle', 'field_content_setup')
              ->fieldCondition('field_content_date', 'value', $dates, 'IN')
              ->fieldCondition('field_content_term', 'tid', $tids, 'IN')
              ->addExtraField('field_content_date', 'value')
              ->addExtraField('field_content_term', 'tid');

I have 3 items on the database, on of which has no value for the textfield (not included here). This previous query returns all 3 items.

Now, doing this

  $efq->entityCondition('entity_type', 'field_collection_item')
              ->entityCondition('bundle', 'field_content_setup')
              ->fieldCondition('field_content_date', 'value', $dates, 'IN')
              ->fieldCondition('field_content_term', 'tid', $tids, 'IN')
              ->addExtraField('field_content_text', 'value')
              ->addExtraField('field_content_date', 'value')
              ->addExtraField('field_content_term', 'tid');

I only get two items.

The reason is, the third item does not have a value.

Is there a way I could get it to return all 3 items and display that the third one has a null value in the textfield?

Regards,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RAWDESK’s picture

I'm experiencing the opposite effect.

 $query = new EntityFieldQueryExtraFields();
  $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'properties')
    ->fieldCondition('field_estate_origin', 'tid', array($whise_tid))
    ->fieldCondition('field_estate_id', 'value','NULL', '!=')
    ->fieldCondition('field_property_status', 'tid', array('2988','3010'), 'NOT IN') 
    ->addExtraField('field_estate_id', 'value');
  $result = $query->execute();

My query result now receives node entities that no longer exist on the node table, in this case for example node 176 :

sqdfsdf

The field_estate_id 2533122 does exist on its respective table though :

dsdf

My guess is in both cases, the additional query logic is somehow not applying the correct JOIN clause between node and field_% tables

Also have my doubts about correctness of node_delete() functions, as it should delete all linked field values:
https://api.drupal.org/comment/63428#comment-63428