function MatcherDumper::__construct

Same name in this branch
  1. 10 core/lib/Drupal/Core/ProxyClass/Routing/MatcherDumper.php \Drupal\Core\ProxyClass\Routing\MatcherDumper::__construct()
Same name in other branches
  1. 9 core/lib/Drupal/Core/ProxyClass/Routing/MatcherDumper.php \Drupal\Core\ProxyClass\Routing\MatcherDumper::__construct()
  2. 9 core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::__construct()
  3. 8.9.x core/lib/Drupal/Core/ProxyClass/Routing/MatcherDumper.php \Drupal\Core\ProxyClass\Routing\MatcherDumper::__construct()
  4. 8.9.x core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::__construct()
  5. 11.x core/lib/Drupal/Core/ProxyClass/Routing/MatcherDumper.php \Drupal\Core\ProxyClass\Routing\MatcherDumper::__construct()
  6. 11.x core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::__construct()

Construct the MatcherDumper.

Parameters

\Drupal\Core\Database\Connection $connection: The database connection which will be used to store the route information.

\Drupal\Core\State\StateInterface $state: The state.

\Psr\Log\LoggerInterface|null $logger: The logger.

string $table: (optional) The table to store the route info in. Defaults to 'router'.

File

core/lib/Drupal/Core/Routing/MatcherDumper.php, line 68

Class

MatcherDumper
Dumps Route information to a database table.

Namespace

Drupal\Core\Routing

Code

public function __construct(Connection $connection, StateInterface $state, LoggerInterface|string|null $logger = NULL, $table = 'router') {
    $this->connection = $connection;
    $this->state = $state;
    if (is_string($logger) || is_null($logger)) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
        $this->logger = \Drupal::service('logger.channel.router');
        $this->tableName = $logger;
    }
    else {
        $this->logger = $logger;
    }
    if (is_null($this->tableName)) {
        $this->tableName = $table;
    }
}

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