Answer the question
In order to leave comments, you need to log in
Why doesn't relation work in yii2?
Tags.php
public function getArt() {
$this->hasMany(Art::className(), ['id' => 'art_id'])
->viaTable('art_tag', ['tag_id' => 'id']);
}
$tag = Tags::find()->joinWith('art')->where(['id' => $tag])->all();
backend\models\Tags has no relation named "art".
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question