Is that possible to use variable in the onCondition?
Here is the relation:
public function getMybook()
{
return $this->hasOne(Book::className(), ['book_id' => 'idbook'])->onCondition(['user_id' => $user_id]);
}
I want to use it in joinWith like below:
$books = Books::find()->joinWith('myBook')->all();
But how do I send the user_id parameter into the onConditon? Thanks!