protected function GdprSqlDump::createTableClones in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 modules/gdpr_dump/src/Service/GdprSqlDump.php \Drupal\gdpr_dump\Service\GdprSqlDump::createTableClones()
- 3.0.x modules/gdpr_dump/src/Service/GdprSqlDump.php \Drupal\gdpr_dump\Service\GdprSqlDump::createTableClones()
Creates table clones according to the config.
Throws
\Drupal\Core\Database\TransactionNoActiveException
\Drupal\Core\Database\TransactionCommitFailedException
\InvalidArgumentException
\Drupal\Core\Database\IntegrityConstraintViolationException
\Drupal\Core\Database\DatabaseExceptionWrapper
\Exception
1 call to GdprSqlDump::createTableClones()
- GdprSqlDump::prepare in modules/
gdpr_dump/ src/ Service/ GdprSqlDump.php - Prepare the database for the dump.
File
- modules/
gdpr_dump/ src/ Service/ GdprSqlDump.php, line 245
Class
- GdprSqlDump
- Class GdprSqlDump.
Namespace
Drupal\gdpr_dump\ServiceCode
protected function createTableClones() {
$tables = \array_keys($this->tablesToAnonymize);
$transaction = $this->database
->startTransaction('gdpr_clone_tables');
foreach ($tables as $table) {
$queryString = $this
->createCloneQueryString($table);
if (NULL === $queryString) {
// @todo: Notify?
continue;
}
try {
if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
drush_print("Executing: '{$queryString}'", 0, STDERR);
}
$query = $this->database
->query($queryString);
$query
->execute();
} catch (\Exception $e) {
drush_print("Error while cloning the '{$table}' table.");
$transaction
->rollBack();
}
}
$this->database
->popTransaction($transaction
->name());
}