3 namespace Drupal\workspaces;
5 use Drupal\Core\Database\Connection;
6 use Drupal\Core\Entity\EntityTypeManagerInterface;
9 * Defines a factory class for workspace operations.
11 * @see \Drupal\workspaces\WorkspaceOperationInterface
12 * @see \Drupal\workspaces\WorkspacePublisherInterface
16 class WorkspaceOperationFactory {
19 * The entity type manager.
21 * @var \Drupal\Core\Entity\EntityTypeManagerInterface
23 protected $entityTypeManager;
26 * The database connection.
28 * @var \Drupal\Core\Database\Connection
33 * Constructs a new WorkspacePublisher.
35 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
36 * The entity type manager.
37 * @param \Drupal\Core\Database\Connection $database
38 * Database connection.
40 public function __construct(EntityTypeManagerInterface $entity_type_manager, Connection $database) {
41 $this->entityTypeManager = $entity_type_manager;
42 $this->database = $database;
46 * Gets the workspace publisher.
48 * @param \Drupal\workspaces\WorkspaceInterface $source
51 * @return \Drupal\workspaces\WorkspacePublisherInterface
52 * A workspace publisher object.
54 public function getPublisher(WorkspaceInterface $source) {
55 return new WorkspacePublisher($this->entityTypeManager, $this->database, $source);