改进数据库操作join自身后出错的问题

This commit is contained in:
thinkphp
2016-12-07 07:16:50 +08:00
parent 0788e048a7
commit 4780d194b5
2 changed files with 6 additions and 0 deletions

View File

@@ -183,6 +183,9 @@ abstract class Builder
$item = [];
foreach ((array) $tables as $key => $table) {
if (!is_numeric($key)) {
if (strpos($key, '@think')) {
$key = strstr($key, '@think', true);
}
$key = $this->parseSqlTable($key);
$item[] = $this->parseKey($key) . ' ' . $this->parseKey($table);
} else {

View File

@@ -716,6 +716,9 @@ class Query
}
}
if (isset($alias)) {
if (isset($this->options['alias'][$table])) {
$table = $table . '@think' . uniqid();
}
$table = [$table => $alias];
$this->alias($table);
}