From 8710555a5b8daf59d81ef2015d088487106aa4d5 Mon Sep 17 00:00:00 2001 From: Bozhidar Hristov Date: Mon, 12 Aug 2019 15:22:34 +0300 Subject: [PATCH] Fix incompatibility with latest mysqldump In MysqldumpGdpr.php line 9: Warning: Declaration of machbarmacher\GdprDump\MysqldumpGdpr::hookTransformColumnValue($tableName, $colName, $colValue) should be compatib le with Ifsnop\Mysqldump\Mysqldump::hookTransformColumnValue($tableName, $colName, $colValue, $row) --- src/MysqldumpGdpr.php | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/MysqldumpGdpr.php b/src/MysqldumpGdpr.php index 1b384aa..d5a64a5 100644 --- a/src/MysqldumpGdpr.php +++ b/src/MysqldumpGdpr.php @@ -40,6 +40,23 @@ public function __construct( unset($dumpSettings['debug-sql']); } parent::__construct($dsn, $user, $pass, $dumpSettings, $pdoSettings); + + $this->setTransformColumnValueHook( + function ($tableName, $colName, $colValue, $row) { + if (!empty($this->gdprReplacements[$tableName][$colName])) { + $replacement = ColumnTransformer::replaceValue( + $tableName, + $colName, + $this->gdprReplacements[$tableName][$colName] + ); + if ($replacement !== false) { + return $replacement; + } + } + + return $colValue; + } + ); } public function getColumnStmt($tableName) @@ -54,22 +71,13 @@ public function getColumnStmt($tableName) } } if ($this->debugSql) { - print "/* SELECT " . implode(",", - $columnStmt) . " FROM `$tableName` */\n\n"; + print "/* SELECT ".implode( + ",", + $columnStmt + )." FROM `$tableName` */\n\n"; } } - return $columnStmt; - } - protected function hookTransformColumnValue($tableName, $colName, $colValue) - { - if (!empty($this->gdprReplacements[$tableName][$colName])) { - $replacement = ColumnTransformer::replaceValue($tableName, $colName, $this->gdprReplacements[$tableName][$colName]); - if($replacement !== FALSE) { - return $replacement; - } - } - return $colValue; + return $columnStmt; } - }