private function join($objectName, $key = null, $joinType = 'LEFT', $primaryKey = null)
{
$joinObj = new $objectName();
if (!$key) {
$key = $objectName . "id";
}
if (!$primaryKey) {
$primaryKey = MysqliDb::$prefix . $joinObj->dbTable . "." . $joinObj->primaryKey;
}
if (!strchr($key, '.')) {
$joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " . $primaryKey;
} else {
$joinStr = MysqliDb::$prefix . "{$key} = " . $primaryKey;
}
$this->db->join($joinObj->dbTable, $joinStr, $joinType);
return $this;
}