8.3.x entity.inc entity_load_multiple_by_properties($entity_type, array $values)
8.0.x entity.inc entity_load_multiple_by_properties($entity_type, array $values)
8.1.x entity.inc entity_load_multiple_by_properties($entity_type, array $values)
8.2.x entity.inc entity_load_multiple_by_properties($entity_type, array $values)
8.4.x entity.inc entity_load_multiple_by_properties($entity_type, array $values)

Load entities by their property values.

\Drupal::entityTypeManager()
  ->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\EntityTypeManagerInterface::getStorage()

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

41 calls to entity_load_multiple_by_properties()
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.
BreadcrumbTest::testBreadCrumbs in core/modules/system/src/Tests/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.
BulkDeleteTest::testDeleteField in core/modules/field/tests/src/Kernel/BulkDeleteTest.php
Verify that deleting a field leaves the field data items in the database and that the appropriate Field API functions can operate on the deleted data and field definition.

... See full list

File

core/includes/entity.inc, line 221
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);
}