OptionalServiceSystemTestController.php

Namespace

Drupal\system_test\Controller

File

core/modules/system/tests/modules/system_test/src/Controller/OptionalServiceSystemTestController.php

View source
<?php

declare (strict_types=1);
namespace Drupal\system_test\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\dblog\Logger\DbLog;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

/**
 * A controller that specifies an optional dependency.
 */
class OptionalServiceSystemTestController extends ControllerBase {
  public function __construct(#[Autowire('logger.dblog')] public readonly ?DbLog $dbLog) {
  }

}

Classes

Title Deprecated Summary
OptionalServiceSystemTestController A controller that specifies an optional dependency.

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