function CheckpointStorage::exists

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php \Drupal\Core\Config\Checkpoint\CheckpointStorage::exists()

Returns whether a configuration object exists.

Parameters

string $name: The name of a configuration object to test.

Return value

bool TRUE if the configuration object exists, FALSE otherwise.

Overrides StorageInterface::exists

File

core/lib/Drupal/Core/Config/Checkpoint/CheckpointStorage.php, line 93

Class

CheckpointStorage
Provides a config storage that can make checkpoints.

Namespace

Drupal\Core\Config\Checkpoint

Code

public function exists($name) {
  if (count($this->checkpoints) === 0) {
    throw new NoCheckpointsException();
  }
  foreach ($this->getCheckpointsToReadFrom() as $checkpoint) {
    $in_checkpoint = $this->getKeyValue($checkpoint->id, $this->collection)
      ->get($name);
    if ($in_checkpoint !== NULL) {
      // If $in_checkpoint is FALSE then the configuration has been deleted.
      return $in_checkpoint !== FALSE;
    }
  }
  return $this->activeStorage
    ->exists($name);
}

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