Answer the question
In order to leave comments, you need to log in
How to make connection with OR?
I drove myself with such a base:
id | article_id | product_id |company_id
In the Forum model, I make a connection with this model to select everything where product_id = product_id or company_id = company_id
So far I have this:
public function getRelatedArticles(){
return $this->hasMany(ArticleRelation::className(),['product_id'=>'product_id'])->union($this->hasMany(ArticleRelation::className(),['company_id'=>'company_id']));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question