Answer the question
In order to leave comments, you need to log in
How to pass a connection to ActiveDataProvider?
The tag model has a link to articles through an intermediate table:
public function getArticles()
{
return $this->hasMany(Article::className(), ['id' => 'articleId'])->viaTable(Relation::tableName(), ['tagId' => 'id']);
}
public function actionTag($tagSlug)
{
$tag = Tag::find()->where(['slug' => $tagSlug])->one();
$articles = Article::find()->???; // как тут быть???
$provider = new ActiveDataProvider([
'query' => $articles,
]);
}
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