255, ], [ [ 'user_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Customer::className(), 'targetAttribute' => [ 'user_id' => 'id' ], ], [ [ 'delivery_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Delivery::className(), 'targetAttribute' => [ 'delivery_id' => 'id' ], ], [ [ 'label_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Label::className(), 'targetAttribute' => [ 'label_id' => 'id' ], ], [ [ 'payment_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Payment::className(), 'targetAttribute' => [ 'payment_id' => 'id' ], ], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('order', 'ID'), 'user_id' => Yii::t('order', 'User ID'), 'name' => Yii::t('order', 'Name'), 'phone' => Yii::t('order', 'Phone'), 'email' => Yii::t('order', 'Email'), 'city' => Yii::t('order', 'City'), 'address' => Yii::t('order', 'Address'), 'comment' => Yii::t('order', 'Comment'), 'label_id' => Yii::t('order', 'Label ID'), 'delivery_id' => Yii::t('order', 'Delivery ID'), 'payment_id' => Yii::t('order', 'Payment ID'), 'created_at' => Yii::t('order', 'Created At'), 'updated_at' => Yii::t('order', 'Updated At'), 'deleted_at' => Yii::t('order', 'Deleted At'), ]; } /** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(Customer::className(), [ 'id' => 'user_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getDelivery() { return $this->hasOne(Delivery::className(), [ 'id' => 'delivery_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getLabel() { return $this->hasOne(Label::className(), [ 'id' => 'label_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getPayment() { return $this->hasOne(Payment::className(), [ 'id' => 'payment_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getOrderProducts() { return $this->hasMany(OrderProduct::className(), [ 'order_id' => 'id' ]); } }