You are here

public function RevisionTracker::setLatestRevision in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/RevisionTracker.php \Drupal\workbench_moderation\RevisionTracker::setLatestRevision()

Sets the latest revision of a given entity.

Parameters

string $entity_type: The machine name of the type of entity.

string $entity_id: The Entity ID in question.

string $langcode: The langcode of the revision we're saving. Each language has its own effective tree of entity revisions, so in different languages different revisions will be "latest".

string $revision_id: The revision ID that is now the latest revision.

Return value

static

Overrides RevisionTrackerInterface::setLatestRevision

File

src/RevisionTracker.php, line 44

Class

RevisionTracker
Tracks metadata about revisions across entities.

Namespace

Drupal\workbench_moderation

Code

public function setLatestRevision($entity_type, $entity_id, $langcode, $revision_id) {
  try {
    $this
      ->recordLatestRevision($entity_type, $entity_id, $langcode, $revision_id);
  } catch (DatabaseExceptionWrapper $e) {
    $this
      ->ensureTableExists();
    $this
      ->recordLatestRevision($entity_type, $entity_id, $langcode, $revision_id);
  }
  return $this;
}