function WorkspaceAssociation::initializeWorkspace
Same name in other branches
- 9 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
- 10 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
- 11.x core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
Overrides WorkspaceAssociationInterface::initializeWorkspace
1 call to WorkspaceAssociation::initializeWorkspace()
- WorkspaceAssociation::workspaceInsert in core/
modules/ workspaces/ src/ WorkspaceAssociation.php - Responds to the creation of a new workspace entity.
File
-
core/
modules/ workspaces/ src/ WorkspaceAssociation.php, line 233
Class
- WorkspaceAssociation
- Provides a class for CRUD operations on workspace associations.
Namespace
Drupal\workspacesCode
public function initializeWorkspace(WorkspaceInterface $workspace) {
if ($parent_id = $workspace->parent->target_id) {
$indexed_rows = $this->database
->select(static::TABLE);
$indexed_rows->addExpression(':new_id', 'workspace', [
':new_id' => $workspace->id(),
]);
$indexed_rows->fields(static::TABLE, [
'target_entity_type_id',
'target_entity_id',
'target_entity_revision_id',
]);
$indexed_rows->condition('workspace', $parent_id);
$this->database
->insert(static::TABLE)
->from($indexed_rows)
->execute();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.