You are here

public static function DetailController::create in MongoDB 8.2

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ControllerBase::create

File

modules/mongodb_watchdog/src/Controller/DetailController.php, line 161

Class

DetailController
The controller for the event detail page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

public static function create(ContainerInterface $container) : self {

  /** @var \Psr\Log\LoggerInterface $logger */
  $logger = $container
    ->get('logger.channel.mongodb_watchdog');

  /** @var \Drupal\mongodb_watchdog\Logger $watchdog */
  $watchdog = $container
    ->get(Logger::SERVICE_LOGGER);

  /** @var \Drupal\Core\Config\ImmutableConfig $config */
  $config = $container
    ->get('config.factory')
    ->get('mongodb_watchdog.settings');

  /** @var \Drupal\mongodb_watchdog\EventController $eventController */
  $eventController = $container
    ->get('mongodb.watchdog_event_controller');

  /** @var \Drupal\Core\Pager\PagerManagerInterface $pagerManager */
  $pagerManager = $container
    ->get('pager.manager');
  return new static($logger, $watchdog, $config, $eventController, $pagerManager);
}