You are here

protected function ChangesListController::getPointerToWorkspace in Workspace 8

Returns a pointer to the specified workspace.

In most cases this pointer will be unique, but that is not guaranteed by the schema. If there are multiple pointers, which one is returned is undefined.

Parameters

\Drupal\multiversion\Entity\WorkspaceInterface $workspace: The workspace for which we want a pointer.

Return value

\Drupal\workspace\WorkspacePointerInterface The pointer to the provided workspace.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

1 call to ChangesListController::getPointerToWorkspace()
ChangesListController::viewChanges in src/Controller/ChangesListController.php
View a list of changes between current workspace and the target workspace.

File

src/Controller/ChangesListController.php, line 371

Class

ChangesListController

Namespace

Drupal\workspace\Controller

Code

protected function getPointerToWorkspace(WorkspaceInterface $workspace) {
  $pointers = $this->entityTypeManager
    ->getStorage('workspace_pointer')
    ->loadByProperties([
    'workspace_pointer' => $workspace
      ->id(),
  ]);
  $pointer = reset($pointers);
  return $pointer;
}