/** * @return \yii\db\ActiveQuery */ public function getCategories() { return $this->hasMany(Categories::className(), ['id' => 'category_id'])->viaTable(ProductsCategories::tableName(), ['product_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getProductsCategories() { return $this->hasMany(ProductsCategories::className(), ['category_id' => 'id']); }