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

Breadcrumb

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

function Kernel::buildContainer

Builds the service container.

Throws

\RuntimeException

1 call to Kernel::buildContainer()
Kernel::initializeContainer in vendor/symfony/http-kernel/Kernel.php
Initializes the service container.

File

vendor/symfony/http-kernel/Kernel.php, line 595

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

protected function buildContainer() : ContainerBuilder {
    foreach ([
        'cache' => $this->getCacheDir(),
        'build' => $this->warmupDir ?: $this->getBuildDir(),
        'logs' => $this->getLogDir(),
    ] as $name => $dir) {
        if (!is_dir($dir)) {
            if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
                throw new \RuntimeException(\sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
            }
        }
        elseif (!is_writable($dir)) {
            throw new \RuntimeException(\sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
        }
    }
    $container = $this->getContainerBuilder();
    $container->addObjectResource($this);
    $this->prepareContainer($container);
    $this->registerContainerConfiguration($this->getContainerLoader($container));
    return $container;
}
RSS feed
Powered by Drupal