AliasStorage::ensureTableExists

protected AliasStorage::ensureTableExists()

Check if the table exists and create it if not.

File

core/lib/Drupal/Core/Path/AliasStorage.php, line 371

Class

AliasStorage
Provides a class for CRUD operations on path aliases.

Namespace

Drupal\Core\Path

Code

protected function ensureTableExists() {
  try {
    $database_schema = $this->connection->schema();
    if (!$database_schema->tableExists(static::TABLE)) {
      $schema_definition = $this->schemaDefinition();
      $database_schema->createTable(static::TABLE, $schema_definition);
      return TRUE;
    }
  }
  // If another process has already created the table, attempting to recreate
  // it will throw an exception. In this case just catch the exception and do
  // nothing.
  catch (SchemaObjectExistsException $e) {
    return TRUE;
  }
  return FALSE;
}
doc_Drupal
2016-10-29 08:44:13
Comments
Leave a Comment

Please login to continue.