function DatabaseStorage::doWrite

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::doWrite()
  2. 10 core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::doWrite()
  3. 11.x core/lib/Drupal/Core/Config/DatabaseStorage.php \Drupal\Core\Config\DatabaseStorage::doWrite()

Helper method so we can re-try a write.

Parameters

string $name: The config name.

string $data: The config data, already dumped to a string.

Return value

bool

1 call to DatabaseStorage::doWrite()
DatabaseStorage::write in core/lib/Drupal/Core/Config/DatabaseStorage.php
Writes configuration data to the storage.

File

core/lib/Drupal/Core/Config/DatabaseStorage.php, line 145

Class

DatabaseStorage
Defines the Database storage.

Namespace

Drupal\Core\Config

Code

protected function doWrite($name, $data) {
    // @todo Remove the 'return' option in Drupal 11.
    // @see https://www.drupal.org/project/drupal/issues/3256524
    $options = [
        'return' => Database::RETURN_AFFECTED,
    ] + $this->options;
    return (bool) $this->connection
        ->merge($this->table, $options)
        ->keys([
        'collection',
        'name',
    ], [
        $this->collection,
        $name,
    ])
        ->fields([
        'data' => $data,
    ])
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.