Exemple #1
0
 public function getColors()
 {
     return $this->hasMany(Color::className(), ['id' => 'color_id'])->viaTable('product_color', ['product_id' => 'id']);
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getColor()
 {
     return $this->hasOne(Color::className(), ['id' => 'color_id']);
 }