You are here

protected function ContentEntityStorageTrait::trackConflicts in Multiversion 8.2

Same name and namespace in other branches
  1. 8 src/Entity/Storage/ContentEntityStorageTrait.php \Drupal\multiversion\Entity\Storage\ContentEntityStorageTrait::trackConflicts()

Uses the Conflict Tracker service to track conflicts for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to track for which to track conflicts.

1 call to ContentEntityStorageTrait::trackConflicts()
ContentEntityStorageTrait::save in src/Entity/Storage/ContentEntityStorageTrait.php

File

src/Entity/Storage/ContentEntityStorageTrait.php, line 494

Class

ContentEntityStorageTrait

Namespace

Drupal\multiversion\Entity\Storage

Code

protected function trackConflicts(EntityInterface $entity) {
  $workspace = Workspace::load($this
    ->getWorkspaceId());

  /** @var \Drupal\multiversion\Conflict\ConflictTrackerInterface $conflictTracker */
  $conflictTracker = \Drupal::service('multiversion.conflict_tracker')
    ->useWorkspace($workspace);
  $index_factory = \Drupal::service('multiversion.entity_index.factory');

  /** @var \Drupal\multiversion\Entity\Index\RevisionTreeIndexInterface $tree */
  $tree = $index_factory
    ->get('multiversion.entity_index.rev.tree', $workspace);
  $conflicts = $tree
    ->getConflicts($entity
    ->uuid());
  if ($conflicts) {
    $conflictTracker
      ->add($entity
      ->uuid(), $conflicts, TRUE);
  }
  else {
    $conflictTracker
      ->resolveAll($entity
      ->uuid());
  }
}