mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
改进Query类
This commit is contained in:
@@ -875,7 +875,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
|
|
||||||
// 设置当前数据表和模型名
|
// 设置当前数据表和模型名
|
||||||
if (!empty($class->table)) {
|
if (!empty($class->table)) {
|
||||||
self::$links[$model]->table($class->table);
|
self::$links[$model]->setTable($class->table);
|
||||||
} else {
|
} else {
|
||||||
$name = !empty($class->name) ? $class->name : basename(str_replace('\\', '/', $model));
|
$name = !empty($class->name) ? $class->name : basename(str_replace('\\', '/', $model));
|
||||||
self::$links[$model]->name($name);
|
self::$links[$model]->name($name);
|
||||||
|
|||||||
@@ -786,14 +786,26 @@ class Query
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定数据表
|
* 指定默认数据表
|
||||||
|
* @access public
|
||||||
|
* @param string $table 表名
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setTable($table)
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定当前操作的数据表
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $table 表名
|
* @param string $table 表名
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function table($table)
|
public function table($table)
|
||||||
{
|
{
|
||||||
$this->table = $table;
|
$this->options['table'] = $table;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user