You are here

class WorkspaceOperationFactory in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/WorkspaceOperationFactory.php \Drupal\workspaces\WorkspaceOperationFactory
  2. 10 core/modules/workspaces/src/WorkspaceOperationFactory.php \Drupal\workspaces\WorkspaceOperationFactory

Defines a factory class for workspace operations.

@internal

Hierarchy

Expanded class hierarchy of WorkspaceOperationFactory

See also

\Drupal\workspaces\WorkspaceOperationInterface

\Drupal\workspaces\WorkspacePublisherInterface

2 files declare their use of WorkspaceOperationFactory
WorkspaceDeployForm.php in core/modules/workspaces/src/Form/WorkspaceDeployForm.php
WorkspaceMergeForm.php in core/modules/workspaces/src/Form/WorkspaceMergeForm.php
1 string reference to 'WorkspaceOperationFactory'
workspaces.services.yml in core/modules/workspaces/workspaces.services.yml
core/modules/workspaces/workspaces.services.yml
1 service uses WorkspaceOperationFactory
workspaces.operation_factory in core/modules/workspaces/workspaces.services.yml
Drupal\workspaces\WorkspaceOperationFactory

File

core/modules/workspaces/src/WorkspaceOperationFactory.php, line 17

Namespace

Drupal\workspaces
View source
class WorkspaceOperationFactory {

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * The database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $database;

  /**
   * The workspace manager.
   *
   * @var \Drupal\workspaces\WorkspaceManagerInterface
   */
  protected $workspaceManager;

  /**
   * The workspace association service.
   *
   * @var \Drupal\workspaces\WorkspaceAssociationInterface
   */
  protected $workspaceAssociation;

  /**
   * The cache tags invalidator.
   *
   * @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface
   */
  protected $cacheTagsInvalidator;

  /**
   * Constructs a new WorkspacePublisher.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Database\Connection $database
   *   Database connection.
   * @param \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager
   *   The workspace manager service.
   * @param \Drupal\workspaces\WorkspaceAssociationInterface $workspace_association
   *   The workspace association service.
   * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tags_invalidator
   *   The cache tags invalidator service.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager, Connection $database, WorkspaceManagerInterface $workspace_manager, WorkspaceAssociationInterface $workspace_association, CacheTagsInvalidatorInterface $cache_tags_invalidator) {
    $this->entityTypeManager = $entity_type_manager;
    $this->database = $database;
    $this->workspaceManager = $workspace_manager;
    $this->workspaceAssociation = $workspace_association;
    $this->cacheTagsInvalidator = $cache_tags_invalidator;
  }

  /**
   * Gets the workspace publisher.
   *
   * @param \Drupal\workspaces\WorkspaceInterface $source
   *   A workspace entity.
   *
   * @return \Drupal\workspaces\WorkspacePublisherInterface
   *   A workspace publisher object.
   */
  public function getPublisher(WorkspaceInterface $source) {
    return new WorkspacePublisher($this->entityTypeManager, $this->database, $this->workspaceManager, $this->workspaceAssociation, $source);
  }

  /**
   * Gets the workspace merger.
   *
   * @param \Drupal\workspaces\WorkspaceInterface $source
   *   The source workspace entity.
   * @param \Drupal\workspaces\WorkspaceInterface $target
   *   The target workspace entity.
   *
   * @return \Drupal\workspaces\WorkspaceMergerInterface
   *   A workspace merger object.
   */
  public function getMerger(WorkspaceInterface $source, WorkspaceInterface $target) {
    return new WorkspaceMerger($this->entityTypeManager, $this->database, $this->workspaceAssociation, $this->cacheTagsInvalidator, $source, $target);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WorkspaceOperationFactory::$cacheTagsInvalidator protected property The cache tags invalidator.
WorkspaceOperationFactory::$database protected property The database connection.
WorkspaceOperationFactory::$entityTypeManager protected property The entity type manager.
WorkspaceOperationFactory::$workspaceAssociation protected property The workspace association service.
WorkspaceOperationFactory::$workspaceManager protected property The workspace manager.
WorkspaceOperationFactory::getMerger public function Gets the workspace merger.
WorkspaceOperationFactory::getPublisher public function Gets the workspace publisher.
WorkspaceOperationFactory::__construct public function Constructs a new WorkspacePublisher.