You are here

public function AcsfVariableStorage::getMatch in Acquia Cloud Site Factory Connector 8.2

Same name and namespace in other branches
  1. 8 src/AcsfVariableStorage.php \Drupal\acsf\AcsfVariableStorage::getMatch()

Retrieves variables whose names match a substring.

Parameters

string $match: A substring that must occur in the variable name.

Return value

array An associative array holding the values of the variables, keyed by the variable names.

File

src/AcsfVariableStorage.php, line 90

Class

AcsfVariableStorage
Encapsulates functionality to interact with ACSF variables.

Namespace

Drupal\acsf

Code

public function getMatch($match) {
  $return = [];
  $result = $this->connection
    ->select('acsf_variables', 'v')
    ->fields('v', [
    'name',
    'value',
  ])
    ->condition('name', '%' . $match . '%', 'LIKE')
    ->execute();
  while ($record = $result
    ->fetchAssoc()) {
    $return[$record['name']] = unserialize($record['value']);
  }
  return $return;
}