public static function TopController::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/ TopController.php, line 146
Class
- TopController
- The Top403/Top404 controllers.
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 \MongoDB\Database $database */
$database = $container
->get('mongodb.watchdog_storage');
/** @var \Drupal\Core\Pager\PagerManagerInterface $pagerManager */
$pagerManager = $container
->get('pager.manager');
return new static($logger, $watchdog, $config, $database, $pagerManager);
}