Hi all,

I have successfully loaded an object using EntityFieldQuery and entity_load. I can see that the node object is there by using dpm().

<?php
$query
= new EntityFieldQuery();

$query->entityCondition('entity_type', 'node')
         ->
entityCondition('bundle', 'mynodetype')
         ->
fieldCondition('myfieldtype', 'value', '250', '=')
         ->
addMetaData('account', user_load(1));

$returnedresults = $query->execute();

$node = entity_load('node', array_keys($returnedresults['node']));
?>

But I can't access anything in the $node, for example I use:

<?php
$test
= $node->title;
print
$test;
?>

When I try to do this I get the error:
Notice: Trying to get property of non-object in include_once()

Can anyone tell me what I am doing wrong here? Every google search seem to indicated that this should work...

Comments

I believe entity_load()

I believe entity_load() returns an array of objects so $node would be an array of nodes.

Thanks, you are right...

Thanks, you are right... However when I try to do something like $node[0]->title to get the title of the first node in that array of nodes, it still give me:

Notice: Undefined offset: 0 in include_once() (line 45
Notice: Trying to get property of non-object in include_once() (line 45

Am I accessing the array incorrectly? (still new to PHP)

Why not use the views module?

Why not use the views module?