1

Been trying for the last hour to work this one out.

$query = new EntityFieldQuery();
$query -> entityCondition('entity_type', 'node')
       -> entityCondition('bundle', 'subscription');

$results = $query->execute();

if(isset($results['node'])) {
    $subscription_nids = array_keys($results['node']);
    $nodes = node_load_multiple($subscription_nids, TRUE);
    return $nodes;
} else {
    return FALSE;
}

This is a very simple version of the entire query, but the error is exactly the same:

Warning: Invalid argument supplied for foreach() in DrupalDefaultEntityController->buildQuery() (line 290 of /var/www/ml/data/www/ml.mailapproved.com/includes/entity.inc).

I don't understand what's wrong here.

2

The 2nd argument for node_load_multiple() is an array of conditions; currently you're providing a boolean so when the buildQuery function tries to iterate over the variable you get a warning.

The 3rd argument is to reset the cache (I guess that's what you're trying to do), so the call should be:

$nodes = node_load_multiple($subscription_nids, array(), TRUE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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