You are here

public function FormAssemblyEntityController::loadByProperties in FormAssembly 7

Selects entities to load by property.

Adapted from a patch to EntityStorageControllerInterface::loadByProperties() Patch posted at https://www.drupal.org/files/1184272-77.patch

Parameters

array $values: An array of property values.

The array key is the property name and array value is the value of that property to be matched. The database operator will set to '=' for single values and to 'IN' for an array of values.

File

includes/FormAssemblyEntityController.php, line 86
Provides a controller building upon the Entity API but with some additional display and search.

Class

FormAssemblyEntityController
@file Provides a controller building upon the Entity API but with some additional display and search.

Code

public function loadByProperties($values = array()) {

  // Build a query to fetch the entity IDs.
  $entity_query = new EntityFieldQuery();
  $entity_query
    ->entityCondition('entity_type', 'fa_form');
  $this
    ->buildPropertyQuery($entity_query, $values);
  $result = $entity_query
    ->execute();
  $entities = array();
  if (!empty($result['fa_form'])) {
    $entities = $this
      ->load(array_keys($result['fa_form']));
  }
  return $entities;
}