Example #1
0
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('{{%shop_product_to_category}}', ['category_id' => 'id'])->available();
 }
Example #2
0
 public function getProduct()
 {
     return $this->hasOne(Product::className(), ['id' => 'product_id']);
 }