EntityFieldQuery - to retrieve nodes from db

Public

Query to get all stored nodes from the database. Some conditions commented out but still featured for reference...

Get raw version
php
  1. // get the nids out of the database...
  2. $query = new EntityFieldQuery();
  3. $query
  4. ->entityCondition('entity_type', 'node');
  5. # ->entityCondition('bundle', 'article')
  6. # ->propertyCondition('status', NODE_PUBLISHED)
  7. # ->propertyOrderBy('created', 'DESC')
  8. # ->fieldCondition('field_… ', 'value', array('…', … ))
  9. # ->range(0,10)
  10. # ->addTag('node_access')
  11.  
  12. $result = $query->execute();
  13. $nids = array_keys($result['node']);