255], [['table_id'], 'exist', 'skipOnError' => true, 'targetClass' => Table::class, 'targetAttribute' => ['table_id' => 'id']], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['user_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => 'User ID', 'table_id' => 'Table ID', 'strength' => 'Strength', 'amount' => 'Amount', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * Gets query for [[OrderProducts]]. * * @return \yii\db\ActiveQuery */ public function getOrderProducts() { return $this->hasMany(OrderProduct::class, ['order_id' => 'id']); } /** * Gets query for [[Table]]. * * @return \yii\db\ActiveQuery */ public function getTable() { return $this->hasOne(Table::class, ['id' => 'table_id']); } /** * Gets query for [[User]]. * * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } /** * Gets query for [[Products]]. * * @return \yii\db\ActiveQuery */ public function getProducts() { return $this->hasMany(Product::class, ['id' => 'product_id']) ->viaTable('order_product', ['order_id' => 'id']); } }