<?php

namespace common\modules\comment\models;

use Yii;

/**
 * This is the model class for table "rating".
 *
 * @property integer $rating_id
 * @property string $date_add
 * @property string $date_update
 * @property integer $user_id
 * @property integer $value
 * @property string $model
 * @property integer $model_id
 *
 * @property \common\models\User $user
 */
class Rating extends \yii\db\ActiveRecord
{

    public $rating;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'rating';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['value'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'rating_id' => Yii::t('app', 'Rating ID'),
            'date_add' => Yii::t('app', 'Date Add'),
            'date_update' => Yii::t('app', 'Date Update'),
            'user_id' => Yii::t('app', 'User ID'),
            'entity' => Yii::t('app', 'Entity'),
            'value' => Yii::t('app', 'Value'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(\common\models\User::className(), ['id' => 'user_id']);
    }
}
