Commit 6a63f6ca authored by Alexander Butenko's avatar Alexander Butenko

dbObject: Do not prefix join object with a table name with it already have one

parent fb85c70a
...@@ -401,11 +401,18 @@ class dbObject { ...@@ -401,11 +401,18 @@ class dbObject {
$joinObj = new $objectName; $joinObj = new $objectName;
if (!$key) if (!$key)
$key = $objectName . "id"; $key = $objectName . "id";
if (!$primaryKey)
if (!$primaryKey)
$primaryKey = $joinObj->primaryKey; $primaryKey = $joinObj->primaryKey;
$joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " . if (!strchr ($key, '.')) {
MysqliDb::$prefix . "{$joinObj->dbTable}.{$primaryKey}"; $joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " .
MysqliDb::$prefix . "{$joinObj->dbTable}.{$joinObj->primaryKey}";
} else {
$joinStr = MysqliDb::$prefix . "{$key} = " .
MysqliDb::$prefix . "{$joinObj->dbTable}.{$joinObj->primaryKey}";
}
$this->db->join ($joinObj->dbTable, $joinStr, $joinType); $this->db->join ($joinObj->dbTable, $joinStr, $joinType);
return $this; return $this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment