From d0bc71f46a745dfd4abb9174cfadb6389f221915 Mon Sep 17 00:00:00 2001 From: paulgav Date: Thu, 4 Oct 2018 10:38:46 +0400 Subject: [PATCH] Add support for accessing row data in the hook --- src/Ifsnop/Mysqldump/Mysqldump.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Ifsnop/Mysqldump/Mysqldump.php b/src/Ifsnop/Mysqldump/Mysqldump.php index 35b9a192..c6bf6b23 100644 --- a/src/Ifsnop/Mysqldump/Mysqldump.php +++ b/src/Ifsnop/Mysqldump/Mysqldump.php @@ -884,7 +884,7 @@ private function prepareColumnValues($tableName, $row) $ret = array(); $columnTypes = $this->tableColumnTypes[$tableName]; foreach ($row as $colName => $colValue) { - $colValue = $this->hookTransformColumnValue($tableName, $colName, $colValue); + $colValue = $this->hookTransformColumnValue($tableName, $colName, $colValue, $row); $ret[] = $this->escape($colValue, $columnTypes[$colName]); } @@ -937,7 +937,7 @@ public function setTransformColumnValueHook($callable) * * @return string */ - protected function hookTransformColumnValue($tableName, $colName, $colValue) + protected function hookTransformColumnValue($tableName, $colName, $colValue, $row) { if (! $this->transformColumnValueCallable) { return $colValue; @@ -947,6 +947,7 @@ protected function hookTransformColumnValue($tableName, $colName, $colValue) $tableName, $colName, $colValue, + $row )); }