You are here

public function GdprDatabaseManager::getTableColumns in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_dump/src/Service/GdprDatabaseManager.php \Drupal\gdpr_dump\Service\GdprDatabaseManager::getTableColumns()
  2. 3.0.x modules/gdpr_dump/src/Service/GdprDatabaseManager.php \Drupal\gdpr_dump\Service\GdprDatabaseManager::getTableColumns()

Fetch the tables with their columns.

Return value

array The tables with their columns.

Throws

\Drupal\Core\Database\InvalidQueryException

File

modules/gdpr_dump/src/Service/GdprDatabaseManager.php, line 42

Class

GdprDatabaseManager
Class GdprDatabaseManager.

Namespace

Drupal\gdpr_dump\Service

Code

public function getTableColumns() {
  $tables = $this->database
    ->schema()
    ->findTables('%');
  $columns = [];
  foreach ($tables as $table) {
    $result = $this
      ->getColumns($table);
    if (NULL === $result) {
      continue;
    }
    $columns[$table] = $result
      ->fetchAll(\PDO::FETCH_ASSOC);
  }
  return $columns;
}