true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'product_id']], [['option_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxOption::className(), 'targetAttribute' => ['option_id' => 'tax_option_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(), ['product_id' => 'product_id']); } /** * @return \yii\db\ActiveQuery */ public function getOption() { return $this->hasOne(TaxOption::className(), ['tax_option_id' => 'option_id']); } }