You are here

protected function WorkbenchModerationSubscriber::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.

@todo Move this to somewhere more logical and globally accessible.

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.

1 call to WorkbenchModerationSubscriber::getPointerToWorkspace()
WorkbenchModerationSubscriber::mergeWorkspaceToParent in src/EventSubscriber/WorkbenchModerationSubscriber.php
Merges a workspace to its parent workspace, if any.

File

src/EventSubscriber/WorkbenchModerationSubscriber.php, line 136

Class

WorkbenchModerationSubscriber
Subscriber for workbench transitions.

Namespace

Drupal\workspace\EventSubscriber

Code

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