mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进parseTable方法和parseJoin 关联预载入支持hasOne自关联
This commit is contained in:
@@ -180,12 +180,17 @@ abstract class Builder
|
||||
protected function parseTable($tables, $options = [])
|
||||
{
|
||||
$item = [];
|
||||
foreach ((array) $tables as $table) {
|
||||
$table = $this->parseSqlTable($table);
|
||||
if (isset($options['alias'][$table])) {
|
||||
$item[] = $this->parseKey($table) . ' ' . $this->parseKey($options['alias'][$table]);
|
||||
foreach ((array) $tables as $key => $table) {
|
||||
if (!is_numeric($key)) {
|
||||
$key = $this->parseSqlTable($key);
|
||||
$item[] = $this->parseKey($key) . ' ' . $this->parseKey($table);
|
||||
} else {
|
||||
$item[] = $this->parseKey($table);
|
||||
$table = $this->parseSqlTable($table);
|
||||
if (isset($options['alias'][$table])) {
|
||||
$item[] = $this->parseKey($table) . ' ' . $this->parseKey($options['alias'][$table]);
|
||||
} else {
|
||||
$item[] = $this->parseKey($table);
|
||||
}
|
||||
}
|
||||
}
|
||||
return implode(',', $item);
|
||||
|
||||
Reference in New Issue
Block a user