true, 'targetClass' => Order::class, 'targetAttribute' => ['order_id' => 'id']], [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::class, 'targetAttribute' => ['product_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'order_id' => 'Order ID', 'product_id' => 'Product ID', ]; } /** * Gets query for [[Order]]. * * @return \yii\db\ActiveQuery */ public function getOrder() { return $this->hasOne(Order::class, ['id' => 'order_id']); } /** * Gets query for [[Product]]. * * @return \yii\db\ActiveQuery */ public function getProduct() { return $this->hasOne(Product::class, ['id' => 'product_id']); } }