Dblayeroo : when creating the tables, if the foreign keys are an object, do not crash

This commit is contained in:
2023-04-04 12:10:08 +02:00
parent d34d5a820a
commit 03c5c78ed7

View File

@@ -519,6 +519,9 @@ class Dblayeroo
$field = implode($this->sep . "," . $this->sep, $field);
$k[1] = explode(",", $k[1]);
$k[1] = implode($this->sep . "," . $this->sep, $k[1]);
if (is_object($k[0])) {
$k[0] = $k[0]->table;
}
$sql .= ",\n FOREIGN KEY($this->sep$field$this->sep) " .
"REFERENCES $this->sep" . $k[0] . "$this->sep($this->sep" .
$k[1] . "$this->sep)";
@@ -632,6 +635,9 @@ class Dblayeroo
$field = implode($this->sep . "," . $this->sep, $field);
$k[1] = explode(",", $k[1]);
$k[1] = implode($this->sep . "," . $this->sep, $k[1]);
if (is_object($k[0])) {
$k[0] = $k[0]->table;
}
$sql .= ",\n FOREIGN KEY($this->sep$field$this->sep) " .
"REFERENCES $this->sep" . $k[0] . "$this->sep($this->sep" .
$k[1] . "$this->sep)";
@@ -745,6 +751,9 @@ class Dblayeroo
$field = implode($this->sep . "," . $this->sep, $field);
$k[1] = explode(",", $k[1]);
$k[1] = implode($this->sep . "," . $this->sep, $k[1]);
if (is_object($k[0])) {
$k[0] = $k[0]->table;
}
$sql .= ",\n FOREIGN KEY(\"$field\") REFERENCES \"" . $k[0] . "\"(\"" .
$k[1] . "\")";
if (isset($k[2])) {