class DrupalKernel

Namespace

Drush\Drupal

Hierarchy

Expanded class hierarchy of DrupalKernel

Members

Contains filters are case sensitive
Name Modifierssort descending Type Description
DrupalKernel::getContainerBuilder protected function @inheritdoc
DrupalKernel::$serviceModifiers protected property @var ServiceModifierInterface[]
DrupalKernel::addServiceModifier public function Add a service modifier to the container builder.
DrupalKernel::createFromRequest public static function @inheritdoc

File

lib/Drush/Drupal/DrupalKernel.php, line 9

View source
class DrupalKernel extends DrupalDrupalKernel {
  /** @var ServiceModifierInterface[] */
  protected $serviceModifiers =[];

  /**
   * @inheritdoc
   */
  public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE, $app_root = NULL) {
    drush_log(dt("Create from request"), LogLevel::DEBUG);
    $kernel = new static($environment, $class_loader, $allow_dumping, $app_root);
    static::bootEnvironment($app_root);
    $kernel->initializeSettings($request);
    return $kernel;
  }

  /**
   * Add a service modifier to the container builder.
   *
   * The container is not compiled until $kernel->boot(), so there is a chance
   * for clients to add compiler passes et. al. before then.
   */
  public function addServiceModifier(ServiceModifierInterface $serviceModifier) {
    drush_log(dt("add service modifier"), LogLevel::DEBUG);
    $this->serviceModifiers[] = $serviceModifier;
  }

  /**
   * @inheritdoc
   */
  protected function getContainerBuilder() {
    drush_log(dt("get container builder"), LogLevel::DEBUG);
    $container = parent::getContainerBuilder();
    foreach ($this->serviceModifiers as $serviceModifier) {
      $serviceModifier->alter($container);
    }
    return $container;
  }
}
1 file declares its use of DrupalKernel
DrupalBoot8.php in lib/Drush/Boot/DrupalBoot8.php