I am programming a new module in my Drupal 7 project. in my module hook_cron is override.
in my hook_cron function, I want to select a node type with specific filter for a cck field.
I am using EntityFieldQuery in order to run a query.
my specific content type is "order_status"
here us the first code of query.
$query->entityCondition('entity_type', 'node')
->propertyCondition('type', array('order_status'))
->propertyCondition('status', 1);
$result = $query->execute();
dpm($result);
this code works with no problem. it collects all nodes with "order_status" content type that are published. (status is 1)
but when I want to add a new cck filter to the query it doesn't work.
I have defined some cck fileds for my "order_status" content type.
one of them is field_order_status_cr_confirm type of this field is boolean (TRUE/FALSE or 1 | 0)
for adding a new filter to my above query I used this code.
->fieldCondition('field_order_status_cr_confirm','value',1,'=');
so my final query is
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->propertyCondition('type', array('order_status'))
->propertyCondition('status', 1)
->fieldCondition('field_order_status_cr_confirm','value',1,'=');
$result = $query->execute();
dpm($result);
but this code doesn't work. it returns nothing. also I changed value of the field_order_status_cr_confirm to 1 but it still returns no data.
Do you know what my problem is ?
here is the dpm function result for one node of "order_status" type.
Please help me.