entity_load_multiple_by_properties($entity_type, array $values)
Load entities by their property values.
\Drupal::entityTypeManager() ->getStorage($entity_type) ->loadByProperties($values);
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.
array An array of entity objects indexed by their IDs. Returns an empty array if no matching entities are found.
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:
\Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
\Drupal\Core\Entity\EntityStorageInterface::loadByProperties()
function entity_load_multiple_by_properties($entity_type, array $values) { return \Drupal::entityManager() ->getStorage($entity_type) ->loadByProperties($values); }
© 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!includes!entity.inc/function/entity_load_multiple_by_properties/8.1.x