<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "district_t".
 *
 * @property integer $id
 * @property string $name
 * @property integer $city_id
 * @property integer $order_id
 * @property string $created_at
 * @property string $updated_at
 */
class DistrictT extends \common\models\Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'district_t';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'city_id'], 'required'],
            [['city_id','order_id'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['name'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'city_id' => 'City ID',
            'order_id' => 'Order ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getCity()
    {
        return $this->hasOne(CityT::className(),['id'=>'city_id']);
    }
}
