TimestampBehavior::className(), 'updatedAtAttribute' => false, ], ]; } /** * @inheritdoc */ public function rules() { return [ [ [ 'label_id', 'order_id', 'user_id', 'created_at', ], 'integer', ], [ [ 'order_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Order::className(), 'targetAttribute' => [ 'order_id' => 'id' ], ], [ [ 'label_id' ], 'exist', 'skipOnError' => true, 'targetClass' => Label::className(), 'targetAttribute' => [ 'label_id' => 'id' ], ], // [ // [ 'user_id' ], // 'exist', // 'skipOnError' => true, // 'targetClass' => User::className(), // 'targetAttribute' => [ 'user_id' => 'id' ], // ], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'ID'), 'label_id' => Yii::t('app', 'Label ID'), 'order_id' => Yii::t('app', 'Order ID'), 'user_id' => Yii::t('app', 'User ID'), 'created_at' => Yii::t('app', 'Created At'), ]; } /** * @return \yii\db\ActiveQuery */ public function getOrder() { return $this->hasOne(Order::className(), [ 'id' => 'order_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getLabel() { return $this->hasOne(Label::className(), [ 'id' => 'label_id' ]); } /** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::className(), [ 'id' => 'user_id' ]); } }