There is an example in the Cookbook:
$query = $cities->find()
->where(function ($exp, $q) {
return $exp->notIn('country_id', ['AFG', 'USA', 'EST']);
});
In SQL this should be aequivalent to: WHERE country_id NOT IN ('AFG', 'USA', 'EST')
Now, I'm trying to use a variable here. Sadly, this won't work:
$query = $cities->find()
->where(function ($exp, $q, $variable) {
return $exp->notIn('country_id', $variable);
});
Any ideas?