You are here

protected function RevisionTreeIndex::buildTree in Multiversion 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Index/RevisionTreeIndex.php \Drupal\multiversion\Entity\Index\RevisionTreeIndex::buildTree()

Helper method to build the revision tree.

6 calls to RevisionTreeIndex::buildTree()
RevisionTreeIndex::countRevs in src/Entity/Index/RevisionTreeIndex.php
@todo: {@link https://www.drupal.org/node/2597422 The revision tree also contain missing revisions. We need a better way to count.}
RevisionTreeIndex::getConflicts in src/Entity/Index/RevisionTreeIndex.php
RevisionTreeIndex::getDefaultBranch in src/Entity/Index/RevisionTreeIndex.php
RevisionTreeIndex::getDefaultRevision in src/Entity/Index/RevisionTreeIndex.php
RevisionTreeIndex::getOpenRevisions in src/Entity/Index/RevisionTreeIndex.php

... See full list

File

src/Entity/Index/RevisionTreeIndex.php, line 275

Class

RevisionTreeIndex
The revision tree index.

Namespace

Drupal\multiversion\Entity\Index

Code

protected function buildTree($uuid) {
  $revs = $this
    ->keyValueStore($uuid)
    ->getAll();
  if (!$revs) {
    $revs = $this
      ->keyValueStore($uuid, 0)
      ->getAll();
  }

  // Build the keys to fetch from the rev index.
  $keys = [];
  foreach (array_keys($revs) as $rev) {
    $keys[] = "{$uuid}:{$rev}";
  }
  $workspace = Workspace::load($this
    ->getWorkspaceId());
  $revs_info = $this->indexFactory
    ->get('multiversion.entity_index.rev', $workspace)
    ->getMultiple($keys);
  return self::doBuildTree($uuid, $revs, $revs_info);
}