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