W3cubDocs

/Drupal 8

function 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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!node!node.module/function/node_load_multiple/8.1.x