From 528b9598593d4103cf9a2ea97441253419954e4d Mon Sep 17 00:00:00 2001 From: Dominique FOURNIER Date: Mon, 3 Apr 2023 20:54:35 +0200 Subject: [PATCH] Dblayeroo : support of objects in foreign parameters --- src/Dblayeroo.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Dblayeroo.php b/src/Dblayeroo.php index 509473e..6b81c0f 100644 --- a/src/Dblayeroo.php +++ b/src/Dblayeroo.php @@ -1466,7 +1466,7 @@ class Dblayeroo $this->DBException("Parameter foreign invalid: " . "ParentField is not provided"); } - if (! is_string($params[0])) { + if (! is_string($params[0]) && ! is_object($params[0])) { $this->DBException("Parameter foreign invalid: " . "parameter 0 is not a string"); } @@ -1474,7 +1474,7 @@ class Dblayeroo $this->DBException("Parameter foreign invalid: " . "parameter 1 is not a string"); } - if (mb_strlen($params[0]) > 64) { + if (is_string($params[0]) && mb_strlen($params[0]) > 64) { $this->DBException("Parameter foreign invalid: " . "parameter 0 is too long"); } @@ -3351,6 +3351,9 @@ class Dblayeroo ); continue; } + if (is_object($params[0])) { + $params[0] = $params[0]->tableprefix . $params[0]->table; + } if (! array_key_exists($params[0], $this->setForeignObj)) { $this->DBException(sprintf(dgettext( "domframework",