function WorkspacesServiceProvider::register

Overrides ServiceProviderBase::register

File

core/modules/workspaces/src/WorkspacesServiceProvider.php, line 19

Class

WorkspacesServiceProvider
Defines a service provider for the Workspaces module.

Namespace

Drupal\workspaces

Code

public function register(ContainerBuilder $container) : void {
  $modules = $container->getParameter('container.modules');
  // Add the entity query override only when the pgsql module is enabled.
  if (isset($modules['pgsql'])) {
    $container->register('pgsql.workspaces.entity.query.sql', 'Drupal\\workspaces\\EntityQuery\\PgsqlQueryFactory')
      ->addArgument(new Reference('database'))
      ->addArgument(new Reference('workspaces.manager'))
      ->addArgument(new Reference('workspaces.information'))
      ->setPublic(FALSE)
      ->setDecoratedService('pgsql.entity.query.sql', NULL, 50);
  }
  $container->registerForAutoconfiguration(WorkspaceProviderInterface::class)
    ->addTag('workspace_provider');
}

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