function MatcherDumper::ensureTableExists

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::ensureTableExists()
  2. 8.9.x core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::ensureTableExists()
  3. 10 core/lib/Drupal/Core/Routing/MatcherDumper.php \Drupal\Core\Routing\MatcherDumper::ensureTableExists()

Checks if the tree table exists and create it if not.

Return value

bool TRUE if the table was created, FALSE otherwise.

1 call to MatcherDumper::ensureTableExists()
MatcherDumper::dump in core/lib/Drupal/Core/Routing/MatcherDumper.php
Dumps a set of routes to the router table in the database.

File

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

Class

MatcherDumper
Dumps Route information to a database table.

Namespace

Drupal\Core\Routing

Code

protected function ensureTableExists() {
    try {
        $this->connection
            ->schema()
            ->createTable($this->tableName, $this->schemaDefinition());
    } catch (DatabaseException $e) {
        // If another process has already created the config table, attempting to
        // recreate it will throw an exception. In this case just catch the
        // exception and do nothing.
    } catch (\Exception $e) {
        return FALSE;
    }
    return TRUE;
}

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