attachSynthetic example

// Only create a new class if we have a container definition.     if (isset($container_definition)) {
      // Drupal provides two dynamic parameters to access specific paths that       // are determined from the request.       $container_definition['parameters']['app.root'] = $this->getAppRoot();
      $container_definition['parameters']['site.path'] = $this->getSitePath();
      $class = Settings::get('container_base_class', '\Drupal\Core\DependencyInjection\Container');
      $container = new $class($container_definition);
    }

    $this->attachSynthetic($container);

    $this->container = $container;
    if ($session_started) {
      $this->container->get('session')->start();
    }

    // The request stack is preserved across container rebuilds. Reinject the     // new session into the main request if one was present before.     if (($request_stack = $this->container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE))) {
      if ($request = $request_stack->getMainRequest()) {
        $subrequest = TRUE;
        
Home | Imprint | This part of the site doesn't use cookies.