Answer the question
In order to leave comments, you need to log in
What is my mistake with deep nested relationship?
actually here is the code
$titleCat=FrontendSetup::findOne(['key_setup'=>'recomented']);
$recomented=Category::find()->where(['name'=>$titleCat->value])->with('goods','goods.images','goods.prise','goods.addfeilds','goods.ratingCountAggregation','goods.ratingSumAggregation')->all();
if(isset($recomented)) {
foreach ($recomented as $rec){
var_dump($rec->goods);
}
}
common\models\Category has no relation named "images".
↵
Caused by: Unknown Method – yii\base\UnknownMethodException
Calling unknown method: common\models\Category::getimages()
in /var/www/magaz.lc/vendor/yiisoft/yii2/base/Component.php at line 285
Answer the question
In order to leave comments, you need to log in
at first glance, everything is in order in this code. Look for the problem in the relationships themselves
To be honest, I'm not sure that yii can do this, I'm talking about goods.images
Perhaps you should first make a join for goods
You have an interesting idea, but I'm not sure if it's viable. Here, rather, in the Category model, you need to create links images, prize, etc. through communication goods.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question