You are here

function entity_load_multiple_by_properties in Drupal 8

Load entities by their property 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

in drupal:8.0.0 and is removed from drupal:9.0.0. Use the entity type storage's loadByProperties() method.

See also

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

1 call to entity_load_multiple_by_properties()
EntityLegacyTest::testEntityLoadMultipleByProperties in core/tests/Drupal/KernelTests/Core/Entity/EntityLegacyTest.php
@expectedDeprecation entity_load_multiple_by_properties() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the entity type storage's loadByProperties() method. See https://www.drupal.org/node/3050910

File

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

Code

function entity_load_multiple_by_properties($entity_type, array $values) {
  @trigger_error('entity_load_multiple_by_properties() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use the entity type storage\'s loadByProperties() method. See https://www.drupal.org/node/3050910', E_USER_DEPRECATED);
  return \Drupal::entityManager()
    ->getStorage($entity_type)
    ->loadByProperties($values);
}