How do I get both published and unpublished records using entity query? How can I get both published and unpublished records for a content type using entity field query?

As per documentation we can filter records by status either published or unpublished. But I need all records irrespective of node status whether is published are unpublished.

 &lt;?php $query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
      -&gt;entityCondition('bundle', 'article')
      -&gt;propertyCondition('status', 1) // only one value accepted here
      -&gt;range(0, 1);
The propertyCondition allows three arguments. You could pass in an array containing the two values and as third parameter the operator 'IN':

-&gt;propertyCondition('status', array(0, 1), 'IN')


Note: As you have been asking for nodes, and nodes AFAIK only have the status 0 or 1, you could also just omit the status property condition entirely and would get all nodes.

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'article')
  -&gt;range(0, 1);