You are here

public function EntityOperations::workspaceInsert in Workspace 8

Hook bridge for hook_workspace_insert()

Parameters

\Drupal\multiversion\Entity\WorkspaceInterface $workspace: The workspace entity that is being created.

See also

hook_ENTITY_TYPE_insert()

File

src/EntityOperations.php, line 48

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\workspace

Code

public function workspaceInsert(WorkspaceInterface $workspace) {

  // Create a new pointer to every Workspace that gets created.
  // This is mainly so that we can always backtrack from a Workspace to a
  // pointer to provide a consistent API to replicators.
  $pointer = $this->entityTypeManager
    ->getStorage('workspace_pointer')
    ->create();
  $pointer
    ->setWorkspace($workspace);
  $pointer
    ->save();
}