mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
改进Query类的table方法和alias方法
This commit is contained in:
@@ -1046,7 +1046,8 @@ class Query
|
|||||||
}
|
}
|
||||||
} elseif (strpos($table, ' ')) {
|
} elseif (strpos($table, ' ')) {
|
||||||
list($table, $alias) = explode(' ', $table);
|
list($table, $alias) = explode(' ', $table);
|
||||||
$this->alias([$table => $alias]);
|
$table = [$table => $alias];
|
||||||
|
$this->alias($table);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$tables = $table;
|
$tables = $table;
|
||||||
@@ -1189,7 +1190,11 @@ class Query
|
|||||||
$this->options['alias'][$key] = $val;
|
$this->options['alias'][$key] = $val;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$table = isset($this->options['table']) ? $this->options['table'] : $this->getTable();
|
if (isset($this->options['table'])) {
|
||||||
|
$table = is_array($this->options['table']) ? key($this->options['table']) : $this->options['table'];
|
||||||
|
} else {
|
||||||
|
$table = $this->getTable();
|
||||||
|
}
|
||||||
|
|
||||||
$this->options['alias'][$table] = $alias;
|
$this->options['alias'][$table] = $alias;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user