I have two relationships defined in my model in the same table
public function getCountry(){
return $this->hasOne(Country::className(),['country_id' => 'country_id']);
}
public function getCurrency(){
return $this->hasOne(Country::className(), ['country_id' => 'currency']);
}
I want to join both relationships in my request. Below code shows the error.
Country::find()->joinWith(['country','currency'])->....
Tried it too
Country::find()->joinWith(['country','currency as cur'])->....
How to specify an alias for the second relationship
source
share