Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContainerBuilder.php

function ContainerBuilder::shareService

1 call to ContainerBuilder::shareService()
ContainerBuilder::createService in vendor/symfony/dependency-injection/ContainerBuilder.php
Creates a service for a service definition.

File

vendor/symfony/dependency-injection/ContainerBuilder.php, line 1725

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

private function shareService(Definition $definition, mixed $service, ?string $id, array &$inlineServices) : void {
    $inlineServices[$id ?? spl_object_hash($definition)] = $service;
    if (null !== $id && $definition->isShared()) {
        if ($definition->isPrivate() && $this->isCompiled()) {
            $this->privates[$id] = $service;
        }
        else {
            $this->services[$id] = $service;
        }
        unset($this->loading[$id]);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal