TranslationUserLanguageMm.php 2.65 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
 * @package    Open20Package
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

namespace elitedivision\amos\translation\models;

use Yii;

/**
 * This is the base-model class for table "translation_user_language_mm".
 *
 * @property integer $user_id
 * @property string $language
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 * @property integer $created_by
 * @property integer $updated_by
 * @property integer $deleted_by
 *
 * @property \backend\models\Language $language0
 * @property \backend\models\User $user
 */
class TranslationUserLanguageMm extends \elitedivision\amos\core\record\Record {

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

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['user_id'], 'required'],
            [['user_id', 'created_by', 'updated_by', 'deleted_by'], 'integer'],
            [['created_at', 'updated_at', 'deleted_at'], 'safe'],
            [['language'], 'safe'],
            [['user_id', 'language'], 'unique', 'targetAttribute' => ['user_id', 'language']],
            [['language'], 'exist', 'skipOnError' => true, 'targetClass' => \lajax\translatemanager\models\Language::className(), 'targetAttribute' => ['language' => 'language_id']],
            [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => \elitedivision\amos\core\user\User::className(), 'targetAttribute' => ['user_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'user_id' => Yii::t('amostranslation', 'User ID'),
            'language' => Yii::t('amostranslation', 'Language'),
            'created_at' => Yii::t('amostranslation', 'Created At'),
            'updated_at' => Yii::t('amostranslation', 'Updated At'),
            'deleted_at' => Yii::t('amostranslation', 'Deleted At'),
            'created_by' => Yii::t('amostranslation', 'Created By'),
            'updated_by' => Yii::t('amostranslation', 'Updated By'),
            'deleted_by' => Yii::t('amostranslation', 'Deleted By'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getLanguage0() {
        return $this->hasOne(\lajax\translatemanager\models\Language::className(), ['language_id' => 'language']);
    }

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

}