Yii2 如何根据它过滤列';她叫什么名字?

Yii2 如何根据它过滤列';她叫什么名字?,yii2,Yii2,我在数据库中有boolean值,在我的GridView中,我试图根据名称而不是id对其进行筛选 我在另一篇专栏文章中这样做了,但不知怎么的,这篇专栏文章没有。有人能解释一下我做错了什么吗?谢谢你的帮助 $query->andFilterWhere(['like', 'customer_name', $this->customer_name]) ->andFilterWhere(['like', 'item.name', $this->ite

我在数据库中有
boolean
值,在我的
GridView
中,我试图根据
名称
而不是
id
对其进行筛选

我在另一篇专栏文章中这样做了,但不知怎么的,这篇专栏文章没有。有人能解释一下我做错了什么吗?谢谢你的帮助

        $query->andFilterWhere(['like', 'customer_name', $this->customer_name])
        ->andFilterWhere(['like', 'item.name', $this->item_id])
        ->andFilterWhere(['like', 'sign', $this->sign])
        ->andFilterWhere(['like', 'customer_surname', $this->customer_surname])
        ->andFilterWhere(['like', 'customer_phone', $this->customer_phone])
        ->andFilterWhere(['like', 'customer_email', $this->customer_email])
        ->andFilterWhere(['like', 'code', $this->code])
        ->andFilterWhere(['like', 'comment', $this->comment]);

我这样做是为了
item.name
,它来自不同的数据库表,并且工作正常。我需要对
符号
列执行相同的操作,它将根据
批准的
拒绝的
进行过滤,而不是根据
id的
。怎么做

如果使用布尔值,则不应使用like运算符,而应使用and和equal运算符

 ->andFilterWhere(['=', 'sign', $this->sign])

通过说
这个专栏没有
,到底是什么不起作用?零行或完全忽略筛选?是否将布尔值与字符串进行比较?如果只批准或拒绝这两个备选方案,则应使用选项1=>Approved和0=>Denied的下拉列表。另外:Equal(=)运算符只查找0(false)值您确定$this->sign是一个布尔值且iw未转换是某种方式吗?我非常确定,因为在
ActiveForm
中,我将其作为复选框值。也在数据库中检查了它的
tinyint(1)
。有趣的情况在这里尝试检查$this->标志的真实内容。。例如:var_dump($this->sign)并告诉我我是
Yii2
的新手。刚刚尝试添加
var\u dump($this->sign)
退出
在`->和filterwhere`条件之后,它将我打印成
字符串(0)“
。这是你想要的吗?