mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-08-30 12:45:32 +08:00
关联定义增加selfRelation方法用于设置是否自关联
This commit is contained in:
@@ -35,6 +35,8 @@ abstract class Relation
|
||||
protected $localKey;
|
||||
// 基础查询
|
||||
protected $baseQuery;
|
||||
// 是否为自关联
|
||||
protected $selfRelation;
|
||||
|
||||
/**
|
||||
* 获取关联的所属模型
|
||||
@@ -66,6 +68,28 @@ abstract class Relation
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前关联为自关联
|
||||
* @access public
|
||||
* @param bool $self 是否自关联
|
||||
* @return $this
|
||||
*/
|
||||
public function selfRelation($self = true)
|
||||
{
|
||||
$this->selfRelation = $self;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前关联是否为自关联
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isSelfRelation()
|
||||
{
|
||||
return $this->selfRelation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装关联数据集
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user