单表的 merge筛选器变成and查询了
itbirds opened this issue · comments
itbirds commented
调用内容如下:
$this->testDAO->merge(['id'=>1,'is_del'=>1])->update(['test'=>1111]);
框架调用过程如下:
- SingleDAO.php 的merge方法,这里实例化了一个SingleFilter类
public function merge($cond=[])
{
return $cond ? new SingleFilter($this, $cond, "or") : $this;
}
2.SingleFilter类继承Filter类,实例化传的参数调用的是Filter里面的构造方法
- 在构造方法里面,有type和link二个变量来影响,查询是and 还是 or查询,内容如下:
elseif (is_array($filter)){
if ($cond){
$this->conds = [[$type => [$cond, [$link=>[[self::valueKey => $filter]]]]]];
} else {
$this->conds = [[$link => [[self::valueKey => $filter]]]];
}
}
问题是:$cond没有传值是null,所以走else判断,直接走了link变量的值,但是link默认是and,而且构造方法并未传这个参数值
BillGe commented
的确是个bug 非常感谢 已修复
itbirds commented
没事不客气