UserInfo.php 3.17 KB
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "user_info".
 *
 * @property integer $user_id
 * @property integer $view_count
 * @property string $busy
 * @property string $date_visit
 * @property string $experience
 * @property string $rank
 * @property string $salary
 * @property string $job
 * @property string $location
 * @property string $soft
 * @property integer $user_info_id
 * @property string $guarantee
 * @property integer $contract
 * @property integer $estimate
 * @property integer $purchase
 * @property integer $delivery
 * @property double $prepayment
 * @property string $about
 * @property integer $type
 */
class UserInfo extends \yii\db\ActiveRecord
{
    // Константа обознащающая физическое лицо
    const USER_TYPE_FIZ = 1;

    // Константа обозначающая компанию
    const USER_TYPE_COMPANY = 2;

    // Константа обозначающая, что компания/физ.лицо свободно
    const USER_STATUS_FREE = 1;

    // Константа обозначающая, что компания/физ.лицо занято
    const USER_STATUS_BUSY = 2;

    // Константа обозначающая, что компания/физ.лицо хочет стать членом МФП
    const USER_MEMBER_FALSE = 1;

    // Константа обозначающая, что компания/физ.лицо не хочет стать членом МФП
    const USER_MEMBER_TRUE = 2;

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

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'],
            [['date_visit'], 'safe'],
            [['experience', 'soft', 'guarantee', 'about', 'city', 'country'], 'string'],
            [['prepayment'], 'number'],

            [['rank', 'location'], 'string', 'max' => 50],
            [['salary', 'job'], 'string', 'max' => 255],
            [['busy', 'member'], 'boolean'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'user_id' => Yii::t('app', 'User ID'),
            'view_count' => Yii::t('app', 'View Count'),
            'busy' => Yii::t('app', 'Busy'),
            'date_visit' => Yii::t('app', 'Date Visit'),
            'experience' => Yii::t('app', 'Experience'),
            'rank' => Yii::t('app', 'Rank'),
            'salary' => Yii::t('app', 'Salary'),
            'job' => Yii::t('app', 'Job'),
            'location' => Yii::t('app', 'Location'),
            'soft' => Yii::t('app', 'Soft'),
            'user_info_id' => Yii::t('app', 'User Info ID'),
            'guarantee' => Yii::t('app', 'Guarantee'),
            'contract' => Yii::t('app', 'Contract'),
            'estimate' => Yii::t('app', 'Estimate'),
            'purchase' => Yii::t('app', 'Purchase'),
            'delivery' => Yii::t('app', 'Delivery'),
            'prepayment' => Yii::t('app', 'Prepayment'),
            'about' => Yii::t('app', 'About'),

        ];
    }
}