mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进关联定义中包含查询条件后重复执行的问题
This commit is contained in:
@@ -1005,9 +1005,11 @@ class Query
|
||||
* @param string $option 参数名
|
||||
* @return $this
|
||||
*/
|
||||
public function removeOption($option)
|
||||
public function removeOption($option = '')
|
||||
{
|
||||
if (isset($this->options[$option])) {
|
||||
if ('' === $option) {
|
||||
$this->options = [];
|
||||
} elseif (isset($this->options[$option])) {
|
||||
unset($this->options[$option]);
|
||||
}
|
||||
return $this;
|
||||
@@ -1658,7 +1660,7 @@ class Query
|
||||
|
||||
/** @var Relation $model */
|
||||
$relation = Loader::parseName($relation, 1, false);
|
||||
$model = $class->$relation();
|
||||
$model = $class->$relation()->removeOption();
|
||||
if ($model instanceof OneToOne && 0 == $model->getEagerlyType()) {
|
||||
$model->eagerly($this, $relation, $subRelation, $closure, $first);
|
||||
$first = false;
|
||||
|
||||
@@ -92,6 +92,17 @@ abstract class Relation
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除关联查询参数
|
||||
* @access public
|
||||
* @return $this
|
||||
*/
|
||||
public function removeOption()
|
||||
{
|
||||
$this->query->removeOption();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if ($this->query) {
|
||||
|
||||
Reference in New Issue
Block a user