<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "order_user_t".
 * status: 0:操作中,1:操作结束,2:退回操作,3:无效操作,4:放弃操作
 * @property integer $id
 * @property integer $user_id
 * @property integer $order_id
 * @property integer $type_id
 * @property integer $status
 * @property string $created_at
 * @property string $updated_at
 */
class OrderUserT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'order_user_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'order_id', 'type_id', 'status'], 'required'],
            [['user_id', 'order_id', 'type_id', 'status'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'order_id' => 'Order ID',
            'type_id' => 'Type ID',
            'status' => 'Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getUser()
    {
        return $this->hasOne(UserT::className(),['id'=>'user_id']);
    }

    public function getOrder()
    {
        return $this->hasOne(OrderT::className(),['id'=>'order_id']);
    }

    public function getType()
    {
        return $this->hasOne(StatusT::className(),['id'=>'type_id']);
    }
}