I have a table exchanges that has standard_parcel_id and return_parcel_id. I want my Parcel model have an Exchange, so my relationship would be:
public function exchange(){
return $this->hasOne(Exchange::class, ['standard_parcel_id', 'return_parcel_id'], ['id', 'id']);
}
In this case no parcel finds its exchanges table record. If I use only one 'id', it will work for the first foreign key, but not for the second one. So in this case:
public function exchange(){
return $this->hasOne(Exchange::class, ['standard_parcel_id', 'return_parcel_id'], ['id']);
}
standard parcels find their Exchange, but return parcels do not.
I have a table exchanges that has standard_parcel_id and return_parcel_id. I want my Parcel model have an Exchange, so my relationship would be:
In this case no parcel finds its exchanges table record. If I use only one 'id', it will work for the first foreign key, but not for the second one. So in this case:
standard parcels find their Exchange, but return parcels do not.
Is there a workaround here?