Active Record 'OR' query
This is a feature request, not a bug. Currently, AR does only AND across Active Query methods. What if we would like to OR, NOT among those methods?
Let me explain with an example.
Lesson::find()->scheduled()->all();// fetch all scheduled lessons Lesson::find()->completed()->all();// fetch all accepted lessons Lesson::find()->canceled()->all();// fetch all canceled lessons
I'd like to do something like this to fetch scheduled or completed lessons
Lesson::find()->scheduled()->or()->completed()->all(); or
Lesson::find()->or(function($query) { $query->scheduled(); $query->completed(); });
Rails: https://stackoverflow.com/questions/3639656/activerecord-or-query http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-or
Sounds reasonable.
Hello. ActiveQuery has method orWhere($condition, $params = []). Do you want to make $condition callable?