You are here

public function StorageBase::setMultiple in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/KeyValueStore/StorageBase.php \Drupal\Core\KeyValueStore\StorageBase::setMultiple()
  2. 10 core/lib/Drupal/Core/KeyValueStore/StorageBase.php \Drupal\Core\KeyValueStore\StorageBase::setMultiple()

Saves key/value pairs.

Parameters

array $data: An associative array of key/value pairs.

Overrides KeyValueStoreInterface::setMultiple

1 method overrides StorageBase::setMultiple()
MemoryStorage::setMultiple in core/lib/Drupal/Core/KeyValueStore/MemoryStorage.php
Saves key/value pairs.

File

core/lib/Drupal/Core/KeyValueStore/StorageBase.php, line 42

Class

StorageBase
Provides a base class for key/value storage implementations.

Namespace

Drupal\Core\KeyValueStore

Code

public function setMultiple(array $data) {
  foreach ($data as $key => $value) {
    $this
      ->set($key, $value);
  }
}