I have a content type called foo
and it has a textfield called field_bar
. I have one that has a value set to baz
.
I'd like to use the EntityFieldQuery object to find all foo
s that have field_bar
with the baz
value.
$nodeQuery = new EntityFieldQuery();
$nodeQuery->entityCondition('entity_type', 'node', '=')
->entityCondition('bundle', 'foo')
->fieldCondition('field_bar', 'value', '12345', '=');
The problem is that I get no results or error back. If I remove the fieldCondition, I get all foo
s including the one I am looking for.
As the documentation is vague and only for experts, I googled a lot, but can't find any reason for my query not returning my node.
I also tried with
->fieldCondition('field_bar', 'value', array('12345'), '=');
to see if that matters, but its the same. I dd
-ed the $nodeQuery
but can't see the executed SQL.
Is there anything special with textfields?
->fieldCondition('field_bar', 'value', '%12345%', 'LIKE');
give you the right results, for example?