修正关联查询的软删除数据问题

This commit is contained in:
thinkphp
2017-04-07 17:28:17 +08:00
parent 92d775765b
commit 29846f5abc
4 changed files with 95 additions and 73 deletions

View File

@@ -33,8 +33,6 @@ abstract class Relation
protected $foreignKey;
// 关联表主键
protected $localKey;
// 关联查询参数
protected $option;
// 基础查询
protected $baseQuery;
@@ -79,17 +77,6 @@ abstract class Relation
return (new $this->model)->toCollection($resultSet);
}
/**
* 移除关联查询参数
* @access public
* @return $this
*/
public function removeOption()
{
$this->query->removeOption();
return $this;
}
/**
* 执行基础查询(仅执行一次)
* @access protected
@@ -105,10 +92,8 @@ abstract class Relation
$result = call_user_func_array([$this->query, $method], $args);
if ($result instanceof Query) {
$this->option = $result->getOptions();
return $this;
} else {
$this->option = [];
$this->baseQuery = false;
return $result;
}