function WorkspaceAssociation::initializeWorkspace
Same name in other branches
- 9 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
- 8.9.x core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
- 10 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::initializeWorkspace()
1 call to WorkspaceAssociation::initializeWorkspace()
- WorkspaceAssociation::workspaceInsert in core/
modules/ workspaces/ src/ WorkspaceAssociation.php
File
-
core/
modules/ workspaces/ src/ WorkspaceAssociation.php, line 360
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();
}
$this->associatedRevisions = $this->associatedInitialRevisions = [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.