public function loadEntitiesByProperties($entity_type, array $values) {
    $entities = $this->entityTypeManager->getStorage($entity_type)->loadByProperties($values);

    if (!empty($entities)) {
      return $entities;
    }
  }
public function loadEntitiesByProperties($entity_type, array $values) {
    $entities = $this->entityTypeManager->getStorage($entity_type)->loadByProperties($values);

    if (!empty($entities)) {
      return $entities;
    }
  }
public function loadEntitiesByProperties ( $ entity_type , array $ values ) { $ entities = $ this -> entityTypeManager -> getStorage ( $ entity_type ) -> loadByProperties ( $ values ) ; if ( ! empty ( $ entities ) ) { return $ entities ; } }
Load entity by property.

@param string $entity_type
Entity type.
@param array $values
An array of properties you want to filter by.

@return \Drupal\Core\Entity\EntityInterface|mixed
An arary of entities.

@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Load entity by property .