Email Id : phpmk888@gmail.com
Yii2 model relation with multiple conditions
In AR Model Relations you can add multiple ON condition using andOnCondition method.
public function getInvoiceItem(){
return $this->hasOne(Invoice::className(), ['order_no' => 'order_no'])->andOnCondition(['item' => $this->order_item])->andOnCondition(['user_id' => $this->user_id]);
}
Yii2 model relation with multiple conditions |
this relation could not use in with() function in ActiveQuery.
ReplyDelete
ReplyDeleteI like your suggestions they are really helpful. Thank you so much for sharing this post.
Yii Framework Team in India