purgeDeletedWorkspacesBatch example

// Ensure that workspace batch purging does not happen inside a workspace.     $workspace_manager->executeOutsideWorkspace(function D) use ($workspace_manager$entities) {
      // Add the IDs of the deleted workspaces to the list of workspaces that will       // be purged on cron.       $state = \Drupal::state();
      $deleted_workspace_ids = $state->get('workspace.deleted', []);
      $deleted_workspace_ids += array_combine(array_keys($entities)array_keys($entities));
      $state->set('workspace.deleted', $deleted_workspace_ids);

      // Trigger a batch purge to allow empty workspaces to be deleted       // immediately.       $workspace_manager->purgeDeletedWorkspacesBatch();
    });
  }

}
Home | Imprint | This part of the site doesn't use cookies.