<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%ARTICLE}}".
 *
 * @property string $ID
 * @property string $COUNTRY_ID 国家ID
 * @property string $TITLE 标题
 * @property string $CID 分类ID
 * @property string $CONTENT 内容
 * @property int $STATUS 状态
 * @property int $SORT 排序值
 * @property int $CREATED_AT 创建时间
 */
class Article extends \common\components\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%ARTICLE}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['CID', 'CREATED_AT', 'COUNTRY_ID'], 'required'],
            [['COUNTRY_ID'], 'string'],
            [['STATUS', 'CREATED_AT', 'SORT'], 'integer'],
            [['ID', 'CID'], 'string', 'max' => 32],
            [['TITLE'], 'string', 'max' => 255],
            [['CONTENT'], 'string', 'max' => 4000],
            [['TITLE'], 'unique'],
            [['ID'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'TITLE' => Yii::t('app', 'title'),
            'COUNTRY_ID' => Yii::t('app', 'country'),
            'CID' => Yii::t('app', 'category'),
            'CONTENT' => Yii::t('app', 'content'),
            'STATUS' => Yii::t('app', 'state'),
            'Order' => Yii::t('app', 'sort'),
            'CREATED_AT' => Yii::t('app', 'createAt'),
        ];
    }
}
