public static function OverviewController::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/ OverviewController.php, line 216
Class
- OverviewController
- The controller for the logger overview page.
Namespace
Drupal\mongodb_watchdog\ControllerCode
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\Core\Datetime\DateFormatterInterface $dateFormatter */
$dateFormatter = $container
->get('date.formatter');
/** @var \Drupal\Core\Form\FormBuilderInterface $formBuilder */
$formBuilder = $container
->get('form_builder');
/** @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler */
$moduleHandler = $container
->get('module_handler');
/** @var \Drupal\Core\Pager\PagerManagerInterface $pagerManager */
$pagerManager = $container
->get('pager.manager');
return new static($logger, $watchdog, $config, $moduleHandler, $formBuilder, $dateFormatter, $pagerManager);
}