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