function EntityStorageBase::loadByProperties
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()
- 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()
- 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::loadByProperties()
Load entities by their property values without any access checks.
Parameters
array $values: An associative array where the keys are the property names and the values are the values those properties must have. If a property takes multiple values, passing an array of values will produce an IN condition.
Return value
\Drupal\Core\Entity\EntityInterface[] An array of entity objects indexed by their ids.
Overrides EntityStorageInterface::loadByProperties
3 methods override EntityStorageBase::loadByProperties()
- ContentEntityNullStorage::loadByProperties in core/
lib/ Drupal/ Core/ Entity/ ContentEntityNullStorage.php - Load entities by their property values without any access checks.
- FieldConfigStorage::loadByProperties in core/
modules/ field/ src/ FieldConfigStorage.php - Load entities by their property values without any access checks.
- FieldStorageConfigStorage::loadByProperties in core/
modules/ field/ src/ FieldStorageConfigStorage.php - Load entities by their property values without any access checks.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php, line 602
Class
- EntityStorageBase
- A base entity storage class.
Namespace
Drupal\Core\EntityCode
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.