Load entities by their property 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.
function entity_load_multiple_by_properties($entity_type, array $values) {
return Drupal::entityManager()
->getStorageController($entity_type)
->loadByProperties($values);
}