This is my actual query -
$dataProvider = new ActiveDataProvider([
'query' => UserProfile::find()->with(['user'])
]);
'status' field is exist in user table. So I want to filter data by where status != 0 but it fails.
I tried this -
1
$dataProvider = new ActiveDataProvider([
'query' => UserProfile::find()->with(['user'])->where('user.status !=',0)
]);
2
$dataProvider = new ActiveDataProvider([
'query' => UserProfile::find()->with(['user'])->where('<>','user.status',0)
]);
None of it works. please let me how its possible?
You need change your $dataProvider
code with this code.
$dataProvider = new ActiveDataProvider([
'query' => UserProfile::find()->joinWith(['user(relation_name)'])->where(['<>','user.status',0])
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With