私はデータベースにboolean
の値を持っていて、私のGridView
にはname
ではなくid
でフィルタリングしようとしています。yii2の名前に従って列をフィルタリングする方法は?
私はそれを他の列で行いましたが、うまくいきましたが、どういうわけか、この列はありません。誰かが私が間違っていることを私に説明することができますか?助けてくれてありがとう。
$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
のためにそれをやりました。私はsign
列に同じことを行う必要があります。これは、id's
ではなく、Approved
またはDenied
に従ってフィルタリングすることです。どうやってするか?
をこの列はnot'、正確に何が動作していないのでしょうか? 'と言っている場合ゼロ行またはフィルタリングを完全に無視しますか? –
ブール値と文字列を比較していますか? 2つの唯一の選択肢が承認済みまたは拒否の場合は、オプション1 =>承認済み、0 =>拒否のドロップダウンが必要です。また:http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html#working-with-model-relations –