Dblayeroo : support of objects in foreign parameters

This commit is contained in:
2023-04-03 20:54:35 +02:00
parent 793f71265d
commit 528b959859

View File

@@ -1466,7 +1466,7 @@ class Dblayeroo
$this->DBException("Parameter foreign invalid: " . $this->DBException("Parameter foreign invalid: " .
"ParentField is not provided"); "ParentField is not provided");
} }
if (! is_string($params[0])) { if (! is_string($params[0]) && ! is_object($params[0])) {
$this->DBException("Parameter foreign invalid: " . $this->DBException("Parameter foreign invalid: " .
"parameter 0 is not a string"); "parameter 0 is not a string");
} }
@@ -1474,7 +1474,7 @@ class Dblayeroo
$this->DBException("Parameter foreign invalid: " . $this->DBException("Parameter foreign invalid: " .
"parameter 1 is not a string"); "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: " . $this->DBException("Parameter foreign invalid: " .
"parameter 0 is too long"); "parameter 0 is too long");
} }
@@ -3351,6 +3351,9 @@ class Dblayeroo
); );
continue; continue;
} }
if (is_object($params[0])) {
$params[0] = $params[0]->tableprefix . $params[0]->table;
}
if (! array_key_exists($params[0], $this->setForeignObj)) { if (! array_key_exists($params[0], $this->setForeignObj)) {
$this->DBException(sprintf(dgettext( $this->DBException(sprintf(dgettext(
"domframework", "domframework",