function DbDumpCommand::getTables

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

Returns a list of tables, not including those set to be excluded.

Parameters

\Drupal\Core\Database\Connection $connection: The database connection to use.

Return value

array An array of table names.

1 call to DbDumpCommand::getTables()
DbDumpCommand::generateScript in core/lib/Drupal/Core/Command/DbDumpCommand.php
Generates the database script.

File

core/lib/Drupal/Core/Command/DbDumpCommand.php, line 117

Class

DbDumpCommand
Provides a command to dump the current database to a script.

Namespace

Drupal\Core\Command

Code

protected function getTables(Connection $connection) {
    $tables = array_values($connection->schema()
        ->findTables('%'));
    foreach ($tables as $key => $table) {
        // Remove any explicitly excluded tables.
        foreach ($this->excludeTables as $pattern) {
            if (preg_match('/^' . $pattern . '$/', $table)) {
                unset($tables[$key]);
            }
        }
    }
    // Keep the table names sorted alphabetically.
    asort($tables);
    return $tables;
}

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