Posted by adrianmak on December 28, 2012 at 6:12am
I'm learning entityfieldquery api
I wrote a simple module
<?php
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.
Comments
remove space after 'entity_type '
before:
$result = $query->entityCondition('entity_type ', 'node')after:
$result = $query->entityCondition('entity_type', 'node'):)
We need action!!!