function WorkspaceOperationFactory::__construct

Same name in other branches
  1. 9 core/modules/workspaces/src/WorkspaceOperationFactory.php \Drupal\workspaces\WorkspaceOperationFactory::__construct()
  2. 8.9.x core/modules/workspaces/src/WorkspaceOperationFactory.php \Drupal\workspaces\WorkspaceOperationFactory::__construct()
  3. 11.x core/modules/workspaces/src/WorkspaceOperationFactory.php \Drupal\workspaces\WorkspaceOperationFactory::__construct()

Constructs a new WorkspaceOperationFactory.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Database\Connection $database: Database connection.

\Drupal\workspaces\WorkspaceManagerInterface $workspace_manager: The workspace manager service.

\Drupal\workspaces\WorkspaceAssociationInterface $workspace_association: The workspace association service.

\Symfony\Contracts\EventDispatcher\EventDispatcherInterface|\Drupal\Core\Cache\CacheTagsInvalidatorInterface $event_dispatcher: The event dispatcher.

\Psr\Log\LoggerInterface|null $logger: The logger.

File

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

Class

WorkspaceOperationFactory
Defines a factory class for workspace operations.

Namespace

Drupal\workspaces

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, Connection $database, WorkspaceManagerInterface $workspace_manager, WorkspaceAssociationInterface $workspace_association, EventDispatcherInterface|CacheTagsInvalidatorInterface $event_dispatcher, LoggerInterface|EventDispatcherInterface|null $logger = NULL) {
    $this->entityTypeManager = $entity_type_manager;
    $this->database = $database;
    $this->workspaceManager = $workspace_manager;
    $this->workspaceAssociation = $workspace_association;
    if ($event_dispatcher instanceof CacheTagsInvalidatorInterface) {
        $event_dispatcher = \Drupal::service('event_dispatcher');
        @trigger_error('Calling ' . __METHOD__ . '() with the $cache_tags_invalidator argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3440755', E_USER_DEPRECATED);
    }
    elseif (!$event_dispatcher instanceof EventDispatcherInterface) {
        $event_dispatcher = \Drupal::service('event_dispatcher');
        @trigger_error('Calling ' . __METHOD__ . '() without the $event_dispatcher argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/3242573', E_USER_DEPRECATED);
    }
    $this->eventDispatcher = $event_dispatcher;
    $logger = func_get_arg(5);
    if (!$logger instanceof LoggerInterface) {
        $logger = \Drupal::service('logger.channel.workspaces');
        @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
    }
    $this->logger = $logger;
}

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