You are here

public function AcsfVariableStorage::set in Acquia Cloud Site Factory Connector 8

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

Sets a named variable with an optional group.

Parameters

string $name: The name of the variable.

mixed $value: The value of the variable.

string $group: The group name of the variable. Optional.

Return value

int 1 if an INSERT query was executed, 2 for UPDATE.

File

src/AcsfVariableStorage.php, line 42

Class

AcsfVariableStorage
Encapsulates functionality to interact with ACSF variables.

Namespace

Drupal\acsf

Code

public function set($name, $value, $group = NULL) {
  return $this->connection
    ->merge('acsf_variables')
    ->keys([
    'name' => $name,
  ])
    ->fields([
    'group_name' => $group,
    'value' => serialize($value),
  ])
    ->execute();
}