As I can see, AR joins was dropped. I suppose the only way to filter results by related model’s fields is to use inner/outerJoin().
E. g.
Comment::find()->active()->innerJoin('tbl_user', 'tbl_comment.user_id=tbl_user.id')
Seems not good for two reasons:
-
Need to hardcode table names (tbl_user, tbl_comments in my case)
-
All the ‘scopes’ (active() in my case) should be disambiguated, otherwise we’ll get an error like “Column ‘is_disabled’ in where clause is ambiguous”, which is painful for ‘global’ scopes (defined in model’s parent). For example, I’ve extended base ActiveRecord and add some basic ‘scopes’ there (like active() or last()).
Is there any way to avoid these issues?