WorkspaceOperationFactory.php

Same filename in other branches
  1. 9 core/modules/workspaces/src/WorkspaceOperationFactory.php
  2. 8.9.x core/modules/workspaces/src/WorkspaceOperationFactory.php
  3. 10 core/modules/workspaces/src/WorkspaceOperationFactory.php

Namespace

Drupal\workspaces

File

core/modules/workspaces/src/WorkspaceOperationFactory.php

View source
<?php

namespace Drupal\workspaces;

use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
 * Defines a factory class for workspace operations.
 *
 * @see \Drupal\workspaces\WorkspaceOperationInterface
 * @see \Drupal\workspaces\WorkspacePublisherInterface
 *
 * @internal
 */
class WorkspaceOperationFactory {
    public function __construct(EntityTypeManagerInterface $entityTypeManager, Connection $database, WorkspaceManagerInterface $workspaceManager, WorkspaceAssociationInterface $workspaceAssociation, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) {
    }
    
    /**
     * 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, $this->eventDispatcher, $source, $this->logger);
    }
    
    /**
     * 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, $source, $target, $this->logger);
    }

}

Classes

Title Deprecated Summary
WorkspaceOperationFactory Defines a factory class for workspace operations.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.