public function WorkspaceAssociation::deleteAssociations in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::deleteAssociations()
Deletes all the workspace association records for the given workspace.
Parameters
string $workspace_id: A workspace entity ID.
string|null $entity_type_id: (optional) The target entity type of the associations to delete. Defaults to NULL.
string|null $entity_ids: (optional) The target entity IDs of the associations to delete. Defaults to NULL.
Overrides WorkspaceAssociationInterface::deleteAssociations
1 call to WorkspaceAssociation::deleteAssociations()
- WorkspaceAssociation::postPublish in core/
modules/ workspaces/ src/ WorkspaceAssociation.php - Triggers clean-up operations after publishing a workspace.
File
- core/
modules/ workspaces/ src/ WorkspaceAssociation.php, line 215
Class
- WorkspaceAssociation
- Provides a class for CRUD operations on workspace associations.
Namespace
Drupal\workspacesCode
public function deleteAssociations($workspace_id, $entity_type_id = NULL, $entity_ids = NULL) {
$query = $this->database
->delete(static::TABLE)
->condition('workspace', $workspace_id);
if ($entity_type_id) {
$query
->condition('target_entity_type_id', $entity_type_id, '=');
if ($entity_ids) {
$query
->condition('target_entity_id', $entity_ids, 'IN');
}
}
$query
->execute();
}