0

I'm learning entityfieldquery api

I wrote a simple module

function demo_menu() {
  $items = array();
  $items['demo'] = array(
    'page callback' => 'demo_list',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function demo_list() {
  $query=  new EntityFieldQuery();

  $result = $query->entityCondition('entity_type ', 'node')
    ->execute();

  print_r($result);
}

I got this error

EntityFieldQueryException: For this query an entity type must be specified. in EntityFieldQuery->propertyQuery() (line 1195 of C:\openserver\domains\drupal7.localhost\includes\entity.inc).

I read many articles. This is the most simplest query but it is not working.

  • I am closing this question as the error is a typo in the condition used; "entity_type " is not a condition the EntityFieldQuery class understands. Questions where the error is a typo are too localized questions. – kiamlaluno Dec 29 '12 at 17:31
2

Just got the error. remove space from "entity_type "
from this line
$result = $query->entityCondition('entity_type ', 'node') ->execute();

Not the answer you're looking for? Browse other questions tagged or ask your own question.