node_load_multiple

node_load_multiple(array $nids = NULL, $reset = FALSE)

Loads node entities from the database.

This function should be used whenever you need to load more than one node from the database. Nodes are loaded into memory and will not require database access if loaded again during the same page request.

Parameters

array $nids: (optional) An array of entity IDs. If omitted, all entities are loaded.

bool $reset: (optional) Whether to reset the internal node_load() cache. Defaults to FALSE.

Return value

\Drupal\node\NodeInterface[] An array of node entities indexed by nid.

Deprecated

in Drupal 8.x, will be removed before Drupal 9.0. Use \Drupal\node\Entity\Node::loadMultiple().

See also

entity_load_multiple()

\Drupal\Core\Entity\Query\EntityQueryInterface

File

core/modules/node/node.module, line 421
The core module that allows content to be submitted to the site.

Code

function node_load_multiple(array $nids = NULL, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()->getStorage('node')->resetCache($nids);
  }
  return Node::loadMultiple($nids);
}
doc_Drupal
2016-10-29 09:31:55
Comments
Leave a Comment

Please login to continue.