Here's the situation, which I suspect is pretty common:
- A site is deployed where a node type has no fields added.
- Lots of nodes are added.
- The site is changed and a new field is added to the node type.
At this point, I've got my original nodes that do not have a value for the new field. There aren't even any field value records in the database for these nodes.
I now need to query for the nodes where this field is set to a certain value (a new or updated node) OR where it's one of the original nodes. So I'm thinking something like this (note the NULL in my array of possible values):
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'my_content_type')
->fieldCondition('field_myfield', 'value', array('myvalue', NULL));
Unfortunately, this doesn't work, and I suspect it's due to the nature of the join. Is it possible to return results where the field is a certain value OR where there is no record of a value at all?
ps: how do I see/debug the resulting query?