function LinearHistory::getParents

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

Gets a checkpoint's parents.

Parameters

string $id: The checkpoint ID.

Return value

iterable<string, \Drupal\Core\Config\Checkpoint\Checkpoint>

Overrides CheckpointListInterface::getParents

File

core/lib/Drupal/Core/Config/Checkpoint/LinearHistory.php, line 75

Class

LinearHistory
A chronological list of Checkpoint objects.

Namespace

Drupal\Core\Config\Checkpoint

Code

public function getParents(string $id) : \Traversable {
  if (!isset($this->checkpoints[$id])) {
    throw new UnknownCheckpointException(sprintf('The checkpoint "%s" does not exist', $id));
  }
  $checkpoint = $this->checkpoints[$id];
  while ($checkpoint->parent !== NULL) {
    $checkpoint = $this->get($checkpoint->parent);
    (yield $checkpoint->id => $checkpoint);
  }
}

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