function EntityStorageBase::loadByProperties

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()
  2. 10 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()
  3. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()

Overrides EntityStorageInterface::loadByProperties

3 methods override EntityStorageBase::loadByProperties()
ContentEntityNullStorage::loadByProperties in core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
Load entities by their property values.
FieldConfigStorage::loadByProperties in core/modules/field/src/FieldConfigStorage.php
Load entities by their property values.
FieldStorageConfigStorage::loadByProperties in core/modules/field/src/FieldStorageConfigStorage.php
Load entities by their property values.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 572

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function loadByProperties(array $values = []) {
    // Build a query to fetch the entity IDs.
    $entity_query = $this->getQuery();
    $entity_query->accessCheck(FALSE);
    $this->buildPropertyQuery($entity_query, $values);
    $result = $entity_query->execute();
    return $result ? $this->loadMultiple($result) : [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.