<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%ARTICLE}}".
 *
 * @property string $ID
 * @property string $TITLE 标题
 * @property string $CID 分类ID
 * @property string $CONTENT 内容
 * @property int $STATUS 状态
 * @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'], 'required'],
            [['STATUS', 'CREATED_AT'], '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' => '标题',
            'CID' => '分类ID',
            'CONTENT' => '内容',
            'STATUS' => '状态',
            'CREATED_AT' => '创建时间',
        ];
    }
}
