Exemple #1
0
 public function getProductsCategories()
 {
     return $this->hasMany(Categories::className(), ['id' => 'category_id'])->viaTable(CategoryProduct::tableName(), ['product_id' => 'id']);
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategoryProducts()
 {
     return $this->hasMany(CategoryProduct::className(), ['category_id' => 'id']);
 }