function node_load_multiple

Same name in other branches
  1. 7.x modules/node/node.module \node_load_multiple()

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.0.0 and is removed from drupal:9.0.0. Use \Drupal\node\Entity\Node::loadMultiple().

See also

https://www.drupal.org/node/2266845

1 call to node_load_multiple()
NodeLegacyTest::testEntityLegacyCode in core/modules/node/tests/src/Kernel/NodeLegacyTest.php
@expectedDeprecation node_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation node_load() is deprecated in…

File

core/modules/node/node.module, line 459

Code

function node_load_multiple(array $nids = NULL, $reset = FALSE) {
    @trigger_error('node_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\node\\Entity\\Node::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
    if ($reset) {
        \Drupal::entityTypeManager()->getStorage('node')
            ->resetCache($nids);
    }
    return Node::loadMultiple($nids);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.