function LinearHistory::add
Same name in other branches
- 10 core/lib/Drupal/Core/Config/Checkpoint/LinearHistory.php \Drupal\Core\Config\Checkpoint\LinearHistory::add()
Overrides CheckpointListInterface::add
File
-
core/
lib/ Drupal/ Core/ Config/ Checkpoint/ LinearHistory.php, line 103
Class
- LinearHistory
- A chronological list of Checkpoint objects.
Namespace
Drupal\Core\Config\CheckpointCode
public function add(string $id, string|\Stringable $label) : Checkpoint {
if (isset($this->checkpoints[$id])) {
throw new CheckpointExistsException(sprintf('Cannot create a checkpoint with the ID "%s" as it already exists', $id));
}
$checkpoint = new Checkpoint($id, $label, $this->time
->getCurrentTime(), $this->activeCheckpoint?->id);
$this->checkpoints[$checkpoint->id] = $checkpoint;
$this->activeCheckpoint = $checkpoint;
$this->state
->set(self::CHECKPOINT_KEY, $this->checkpoints);
return $checkpoint;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.