Call to undefined method Drupal\mysql\Driver\Database\mysql\Connection::transactionManager()

Created on 29 July 2024, 4 months ago
Updated 12 September 2024, 2 months ago

Problem/Motivation

When trying to generate a dump, I get the error
[error] Error: Call to undefined method Drupal\mysql\Driver\Database\mysql\Connection::transactionManager() in Drupal\gdpr_dump\Service\GdprSqlDump->cleanup() (line 348 of /var/www/html/web/modules/contrib/gdpr/modules/gdpr_dump/src/Service/GdprSqlDump.php) #0 /var/www/html/web/modules/contrib/gdpr/modules/gdpr_dump/src/Service/GdprSqlDump.php(317): Drupal\gdpr_dump\Service\GdprSqlDump->cleanup()

Steps to reproduce

Drupal 9.5.11, php 8.1.18

run

drush gdpr-sql-dump --result-file=sites/default/files/dumps/240729-userdata_anonymisation.sql

Proposed resolution

gdpr/modules/gdpr_dump/src/Service/GdprSqlDump.php l 216 and 348

Use

    if (method_exists($this->database, 'transactionManager')) {
      $this->database->transactionManager()->unpile($transaction->name());
    }
    else {
      // @phpstan-ignore-next-line to handle backward compatibility.
      $this->database->popTransaction($transaction->name());
    }

instead of

    if ($this->database->transactionManager()) {
      $this->database->transactionManager()->unpile($transaction->name());
    }
    else {
      // @phpstan-ignore-next-line to handle backward compatibility.
      $this->database->popTransaction($transaction->name());
    }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇪🇸Spain abelass

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024