Skip to content

Commit ff09f83

Browse files
committed
dbObject: do not add table name in join() if table name already specified
1 parent 5bcbc49 commit ff09f83

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

dbObject.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,12 @@ private function join ($objectName, $key = null, $joinType = 'LEFT', $primaryKey
403403
$key = $objectName . "id";
404404

405405
if (!$primaryKey)
406-
$primaryKey = $joinObj->primaryKey;
406+
$primaryKey = MysqliDb::$prefix . $joinObj->dbTable . "." . $joinObj->primaryKey;
407407

408-
if (!strchr ($key, '.')) {
409-
$joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " .
410-
MysqliDb::$prefix . "{$joinObj->dbTable}.{$joinObj->primaryKey}";
411-
} else {
412-
$joinStr = MysqliDb::$prefix . "{$key} = " .
413-
MysqliDb::$prefix . "{$joinObj->dbTable}.{$joinObj->primaryKey}";
414-
}
408+
if (!strchr ($key, '.'))
409+
$joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " . $primaryKey;
410+
else
411+
$joinStr = MysqliDb::$prefix . "{$key} = " . $primaryKey;
415412

416413
$this->db->join ($joinObj->dbTable, $joinStr, $joinType);
417414
return $this;

0 commit comments

Comments
 (0)