mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进关联模型
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace think\model\relation;
|
||||
|
||||
use think\db\Query;
|
||||
use think\Loader;
|
||||
use think\Model;
|
||||
use think\model\Relation;
|
||||
@@ -38,7 +37,10 @@ class MorphTo extends Relation
|
||||
$this->alias = $alias;
|
||||
}
|
||||
|
||||
// 动态获取关联数据
|
||||
/**
|
||||
* 延迟获取关联数据
|
||||
* @access public
|
||||
*/
|
||||
public function getRelation()
|
||||
{
|
||||
$morphKey = $this->morphKey;
|
||||
@@ -70,19 +72,6 @@ class MorphTo extends Relation
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预载入关联查询
|
||||
* @access public
|
||||
* @param Query $query 查询对象
|
||||
* @param string $relation 关联名
|
||||
* @param bool $first 是否需要使用基础表
|
||||
* @return void
|
||||
*/
|
||||
public function eagerly(Query $query, $relation, $subRelation, $closure, $first)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 预载入关联查询 返回数据集
|
||||
* @access public
|
||||
@@ -163,4 +152,12 @@ class MorphTo extends Relation
|
||||
$result->setAttr($relation, $data ?: null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行基础查询(进执行一次)
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function baseQuery()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user