You are here

function entity_load_multiple_by_properties in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/entity.inc \entity_load_multiple_by_properties()

Load entities by their property values.

\Drupal::entityManager()
  ->getStorage($entity_type)
  ->loadByProperties($values);

Parameters

string $entity_type: The entity type to load, e.g. node or user.

array $values: An associative array where the keys are the property names and the values are the values those properties must have.

Return value

array An array of entity objects indexed by their IDs. Returns an empty array if no matching entities are found.

Deprecated

as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use the entity storage's loadByProperties() method to load an entity by their property values:

See also

\Drupal\Core\Entity\EntityManagerInterface::getStorage()

\Drupal\Core\Entity\EntityStorageInterface::loadByProperties()

56 calls to entity_load_multiple_by_properties()
BlockContent::getInstances in core/modules/block_content/src/Entity/BlockContent.php
Gets the configured instances of this custom block.
BlockContentCreationTest::testBlockContentCreation in core/modules/block_content/src/Tests/BlockContentCreationTest.php
Creates a "Basic page" block and verifies its consistency in the database.
BlockContentCreationTest::testBlockContentCreationMultipleViewModes in core/modules/block_content/src/Tests/BlockContentCreationTest.php
Creates a "Basic page" block with multiple view modes.
BlockContentCreationTest::testDefaultBlockContentCreation in core/modules/block_content/src/Tests/BlockContentCreationTest.php
Create a default custom block.
block_rebuild in core/modules/block/block.module
Implements hook_rebuild().

... See full list

File

core/includes/entity.inc, line 213
Entity API for handling entities like nodes or users.

Code

function entity_load_multiple_by_properties($entity_type, array $values) {
  return \Drupal::entityManager()
    ->getStorage($entity_type)
    ->loadByProperties($values);
}