EntityStorageBase::loadByProperties

public EntityStorageBase::loadByProperties(array $values = array())

Load entities by their property values.

Parameters

array $values: An associative array where the keys are the property names and the values are the values those properties must have.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entity objects indexed by their ids.

Overrides EntityStorageInterface::loadByProperties

File

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

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function loadByProperties(array $values = array()) {
  // Build a query to fetch the entity IDs.
  $entity_query = $this->getQuery();
  $this->buildPropertyQuery($entity_query, $values);
  $result = $entity_query->execute();
  return $result ? $this->loadMultiple($result) : array();
}
doc_Drupal
2016-10-29 09:07:41
Comments
Leave a Comment

Please login to continue.