From e0a1e6519945b29c0567ddaac9ba6c2565f3c46a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Tue, 3 Dec 2024 17:13:29 +0100
Subject: [PATCH] 1.0.5 (03/12/2024) ------------------

- [Fix] Correction regressions suite sortie 1.0.4...
---
 src/Table.php | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/Table.php b/src/Table.php
index 5b148df..45fff9c 100644
--- a/src/Table.php
+++ b/src/Table.php
@@ -487,7 +487,7 @@ class Table
 
 
 
-    public function merge(array $data, $key, array $options = []): array
+    public function merge(array $data, array|string|null $key, array $options = []): array
     {
         $ddl = $this->getDdl();
         $bdd = $this->getBdd();
@@ -614,9 +614,9 @@ class Table
                     case 'delete':
                         $callbackCount++;
                         $callbackProgress++;
-                        $key = [$this->makeKeyArray($o, $key)];
-                        $this->delete($key);
-                        if ($doCallback) call_user_func($callback, 'delete', $callbackProgress, $callbackCount, $o, $key);
+                        $k = $this->makeKeyArray($o, $key);
+                        $this->delete($k);
+                        if ($doCallback) call_user_func($callback, 'delete', $callbackProgress, $callbackCount, $o, $k);
                         break;
                     case 'soft-delete':
                         $toUpdate = [
@@ -625,9 +625,9 @@ class Table
                         ];
                         $callbackCount++;
                         $callbackProgress++;
-                        $key = $this->makeKeyArray($o, $key);
-                        $this->update($toUpdate, $key, ['ddl' => $ddl]);
-                        if ($doCallback) call_user_func($callback, 'soft-delete', $callbackProgress, $callbackCount, $o, $key);
+                        $k = $this->makeKeyArray($o, $key);
+                        $this->update($toUpdate, $k, ['ddl' => $ddl]);
+                        if ($doCallback) call_user_func($callback, 'soft-delete', $callbackProgress, $callbackCount, $o, $k);
                         break;
                     case 'undelete':
                         $toUpdate = [
@@ -635,9 +635,9 @@ class Table
                             $options['histo-destructeur-id-column'] => null,
                         ];
                         $callbackProgress++;
-                        $key = $this->makeKeyArray($o, $key);
-                        $this->update($toUpdate, $key, ['ddl' => $ddl]);
-                        if ($doCallback) call_user_func($callback, 'undelete', $callbackProgress, $callbackCount, $o, $key);
+                        $k = $this->makeKeyArray($o, $key);
+                        $this->update($toUpdate, $k, ['ddl' => $ddl]);
+                        if ($doCallback) call_user_func($callback, 'undelete', $callbackProgress, $callbackCount, $o, $k);
                         break;
                     case 'update':
                         $toUpdate = $diff;
@@ -646,9 +646,9 @@ class Table
                             $toUpdate[$options['histo-modificateur-id-column']] = $options['histo-user-id'];
                         }
                         $callbackProgress++;
-                        $key = $this->makeKeyArray($o, $key);
+                        $k = $this->makeKeyArray($o, $key);
                         $this->update($toUpdate, $key, ['ddl' => $ddl]);
-                        if ($doCallback) call_user_func($callback, 'update', $callbackProgress, $callbackCount, $toUpdate, $key);
+                        if ($doCallback) call_user_func($callback, 'update', $callbackProgress, $callbackCount, $toUpdate, $k);
 
                         break;
                 }
-- 
GitLab