Answer the question
In order to leave comments, you need to log in
What is wrong with links?
In fact, there are two links
public function getPillowcases(){
return $this->hasOne(Gods::className(),['id'=>'idpillowcases']);
}
public function getDuvetcover(){
return $this->hasOne(Gods::className(),['id'=>'duvetcover']);
}
var_dump($model->pillowcases);
var_dump($model->duvetcover);
id
why and where I could go wrong.
Answer the question
In order to leave comments, you need to log in
Name the relationship differently, the getter first looks for the property in the virtual properties of the record asset, and then in the relationships. You have the duvetcover property and the getter for the connection is the same.
Or don't use a getter when selecting related data:$model->getDuvetcover()->one();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question