MatcherDumper::ensureTableExists

protected MatcherDumper::ensureTableExists()

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

Return value

bool TRUE if the table was created, FALSE otherwise.

File

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

Class

MatcherDumper
Dumps Route information to a database table.

Namespace

Drupal\Core\Routing

Code

protected function ensureTableExists() {
  try {
    if (!$this->connection->schema()->tableExists($this->tableName)) {
      $this->connection->schema()->createTable($this->tableName, $this->schemaDefinition());
      return TRUE;
    }
  }
  catch (SchemaObjectExistsException $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.
    return TRUE;
  }
  return FALSE;
}
doc_Drupal
2016-10-29 09:25:39
Comments
Leave a Comment

Please login to continue.