function WorkspaceAssociation::__construct

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

Constructs a WorkspaceAssociation object.

Parameters

\Drupal\Core\Database\Connection $connection: A database connection for reading and writing path aliases.

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

\Drupal\workspaces\WorkspaceRepositoryInterface $workspace_repository: The Workspace repository service.

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

File

core/modules/workspaces/src/WorkspaceAssociation.php, line 79

Class

WorkspaceAssociation
Provides a class for CRUD operations on workspace associations.

Namespace

Drupal\workspaces

Code

public function __construct(Connection $connection, EntityTypeManagerInterface $entity_type_manager, WorkspaceRepositoryInterface $workspace_repository, ?LoggerInterface $logger = NULL) {
    $this->database = $connection;
    $this->entityTypeManager = $entity_type_manager;
    $this->workspaceRepository = $workspace_repository;
    if ($this->logger === NULL) {
        @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 = \Drupal::service('logger.channel.workspaces');
    }
}

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