true, 'targetClass' => Product::className(), 'targetAttribute' => [ 'product_id' => 'id' ], ], [ [ 'option_id' ], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => [ 'option_id' => 'id' ], ], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'product_id' => Yii::t('product', 'Product ID'), 'option_id' => Yii::t('product', 'Option ID'), ]; } /** * @return \yii\db\ActiveQuery */ public function getProduct() { return $this->hasOne(Product::className(), [ 'id' => 'product_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getOption() { return $this->hasOne(TaxOption::className(), [ 'id' => 'option_id' ]); } }