/** * @return \yii\db\ActiveQuery * Read more at: http://yiiwheels.com/extension/yii2-taggable-behavior */ public function getBlogTags() { $viaTable = '{{%blog_tags_blog}}'; return $this->hasMany(BlogTags::className(), ['id' => 'tag_id'])->viaTable($viaTable, ['blog_id' => 'id']); }