private function tableFactory($isRead = true)
{
$table = $operator = '';
$cacheKey = [];
foreach ($this->table as $key => $val) {
$realTable = $this->getRealTableName($key);
$cacheKey[] = $isRead ? $this->getCacheVer($realTable) : $realTable;
$on = null;
if (isset($this->join[$key])) {
$operator = ' INNER JOIN';
$on = $this->join[$key];
} elseif (isset($this->leftJoin[$key])) {
$operator = ' LEFT JOIN';
$on = $this->leftJoin[$key];
} elseif (isset($this->rightJoin[$key])) {
$operator = ' RIGHT JOIN';
$on = $this->rightJoin[$key];
} else {
empty($table) || ($operator = ' ,');
}
if (is_null($val)) {
$table .= "{$operator} {$realTable}";
} else {
$table .= "{$operator} {$realTable} AS `{$val}`";
}
isset($this->forceIndex[$realTable]) && ($table .= ' force index(' . $this->forceIndex[$realTable] . ') ');
is_null($on) || ($table .= " ON {$on}");
}
if (empty($table)) {
throw new \InvalidArgumentException(Lang::get('_PARSE_SQL_ERROR_NO_TABLE_', $isRead ? 'select' : 'update/delete'));
}
return [$table, $cacheKey];
}