You are here

public function WorkflowRepository::load in Forms Steps 8

Read workflow from the database using a filter array.

Parameters

array $entry: An array containing all the fields used to search the entries in the table.

Return value

object An object containing the loaded entries if found.

See also

Drupal\Core\Database\Connection::select()

File

src/Repository/WorkflowRepository.php, line 136

Class

WorkflowRepository
Class WorkflowRepository.

Namespace

Drupal\forms_steps\Repository

Code

public function load(array $entry = []) {

  // Read all the fields from the dbtng_example table.
  $select = $this->connection
    ->select(self::FORMS_STEPS_WORKFLOW_DB)
    ->fields(self::FORMS_STEPS_WORKFLOW_DB);

  // Add each field and value as a condition to this query.
  foreach ($entry as $field => $value) {
    $select
      ->condition($field, $value);
  }

  // Return the result in object format.
  return $select
    ->execute()
    ->fetchAll();
}